vuex-subscriptions
Subscribe to Vuex mutations
Requirements
Installation
Using Yarn
$ yarn add vuex-subscriptions
Or NPM
$ npm install vuex-subscriptions
Usage
const modules = // Modules const store = // ... plugins: modules
API
addSubscriptions([options])
Creates a new instance of the plugin with the given options. The following options HAS TO be provided to configure the plugin for your specific needs:
subscriptions <Object>
: The keys are the mutations you want to listen for(including namespaces divided my forward-slash) and the value is the a callback function witch takes the state.modules <ModuleTree<any>>
: You could add the subscriptions inside your modules, and have it be namespaced.
Example
If you have multiple callback functions for one mutation you just add the different functions in an array.
const store = // ... plugins:
License
MIT © Andreas Storesund Madsen