Developing an undo/redo plugin

The Google Analytics plugin we just coded is a good and simple example of how the Vuex plugin system can be exploited to add features to your application, without touching the application core code. But what about a more complex plugin? Is the Vuex plugin also suited for more complex operations? Well, of course, it is! In the following pages, we will develop an undo/redo plugin, which is still a simple, but not trivial example.

We can exploit the fact that, in using the Vuex system, we have a single centralized state and this state can only be modified by mutations. The idea is to take a snapshot of the state each time it gets modified. Then, to go back in the mutation history, it is enough to set the current ...

Get Vuex Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.