Closed beckler closed 7 years ago
This should be handled by each plugin. You can provide the interface of such callback by defining plugin factory.
function pluginFactory (done) {
return function plugin (store) {
// ...
}
}
new Vuex.Store({
plugins: [pluginFactory(() => { /* ... */ })]
})
I have a custom plugin to auto save and load the state, but I prefer to use localForage over localStorage. Since localForage only relies on async methods, the views have usually fully mounted before the plugin has finished loading any data to reset the store. This mostly causes problems when I'm trying to do some operations when the page initially loads. Like previously stored auth info.
I would imagine this would be pretty similar to how vue-router handles hooks, something like the following:
I'm not sure of the difficulty of it, or if it goes against a mantra. I figured I would just ask. ¯_(ツ)_/¯