{"id":15559178,"url":"https://github.com/anthonygore/vuex-undo-redo","last_synced_at":"2025-04-06T02:09:58.004Z","repository":{"id":45516024,"uuid":"109360706","full_name":"anthonygore/vuex-undo-redo","owner":"anthonygore","description":"Undo/Redo plugin for Vuex","archived":false,"fork":false,"pushed_at":"2022-12-08T03:32:53.000Z","size":314,"stargazers_count":173,"open_issues_count":16,"forks_count":37,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T00:08:14.945Z","etag":null,"topics":["vue","vuejs","vuex"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anthonygore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-03T06:31:47.000Z","updated_at":"2024-10-17T14:12:16.000Z","dependencies_parsed_at":"2023-01-24T08:15:35.567Z","dependency_job_id":null,"html_url":"https://github.com/anthonygore/vuex-undo-redo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygore%2Fvuex-undo-redo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygore%2Fvuex-undo-redo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygore%2Fvuex-undo-redo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonygore%2Fvuex-undo-redo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthonygore","download_url":"https://codeload.github.com/anthonygore/vuex-undo-redo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["vue","vuejs","vuex"],"created_at":"2024-10-02T15:41:55.524Z","updated_at":"2025-04-06T02:09:57.980Z","avatar_url":"https://github.com/anthonygore.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# vuex-undo-redo\n\nA Vue.js plugin that allows you to undo or redo a mutation.\n\n\u003e The building of this plugin is documented in the article *[Create A Vuex Undo/Redo For VueJS](https://vuejsdevelopers.com/2017/11/13/vue-js-vuex-undo-redo/)*\n\n## Live demos\n\n[![Edit Vuex Undo/Redo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/vjo3xlpyny)\n\nThere's also a demo in [this Codepen](https://codepen.io/anthonygore/pen/NwGmqJ). The source code for the demo is [here](https://github.com/anthonygore/vuex-undo-redo-example).\n\n## Installation\n\n```js\nnpm i --save-dev vuex-undo-redo\n```\n\n### Browser\n\n```html\n\u003cscript type=\"text/javascript\" src=\"node_modules/vuex-undo-redo/dist/vuex-undo-redo.min.js\"\u003e\u003c/script\u003e\n```\n\n### Module\n\n```js\nimport VuexUndoRedo from 'vuex-undo-redo';\n```\n\n## Usage\n\nSince it's a plugin, use it like:\n\n```js\nVue.use(VuexUndoRedo);\n```\n\nYou must, of course, have the Vuex plugin installed as well, and it must be installed before this plugin. You must also create a Vuex store which must implement a mutation `emptyState` which should revert the store back to the initial state e.g.:\n\n```js\nnew Vuex.Store({\n  state: {\n    myVal: null\n  },\n  mutations: {\n    emptyState() {\n      this.replaceState({ myval: null });       \n    }\n  }\n});\n```\n\n### Ignoring mutations\n\nOccasionally, you may want to perform mutations without including them in the undo history (say you are working on an image editor and the user toggles grid visibility - you probably do not want this in undo history). The plugin has an `ignoredMutations` setting to leave these mutations out of the history:\n\n```js\nVue.use(VuexUndoRedo, { ignoreMutations: [ 'toggleGrid' ]});\n```\n\nIt's worth noting that this only means the mutations will not be recorded in the undo history. You must still manually manage your state object in the `emptyState` mutation:\n\n```js\nemptyState(state) {\n  this.replaceState({ myval: null, showGrid: state.showGrid });       \n}\n```\n\n## API\n\n### Options\n\n`ignoredMutations` an array of mutations that the plugin will ignore\n\n### Computed properties\n\n`canUndo` a boolean which tells you if the state is undo-able\n\n`canRedo` a boolean which tells you if the state is redo-able\n\n### Methods\n\n`undo` undoes the last mutation\n\n`redo` redoes the last mutation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonygore%2Fvuex-undo-redo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonygore%2Fvuex-undo-redo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonygore%2Fvuex-undo-redo/lists"}