undo-redo-vuex
Version:
A Vuex plugin for module namespaced undo and redo functionality. This plugin takes inspiration from and extends the work of [vuex-undo-redo](https://github.com/anthonygore/vuex-undo-redo).
22 lines (17 loc) • 695 B
text/typescript
import Vue from "vue";
export const redo = (store: any) => async (namespace: string = "") => {
await store.dispatch(`${namespace ? `${namespace}/` : ""}redo`);
await Vue.nextTick();
};
export const undo = (store: any) => async (namespace: string = "") => {
await store.dispatch(`${namespace ? `${namespace}/` : ""}undo`);
await Vue.nextTick();
};
export const clear = (store: any) => async (namespace: string = "") => {
await store.dispatch(`${namespace ? `${namespace}/` : ""}clear`);
await Vue.nextTick();
};
export const reset = (store: any) => async (namespace: string = "") => {
await store.dispatch(`${namespace ? `${namespace}/` : ""}reset`);
await Vue.nextTick();
};