Skip to content

Commit

Permalink
docs: document new subscribeAction options
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 17, 2019
1 parent acd7249 commit 431540b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const store = new Vuex.Store({ ...options })
- type: `Boolean`
Turn the devtools on or off for a particular vuex instance. For instance passing false tells the Vuex store to not subscribe to devtools plugin. Useful for if you have multiple stores on a single page.
Turn the devtools on or off for a particular vuex instance. For instance passing false tells the Vuex store to not subscribe to devtools plugin. Useful for if you have multiple stores on a single page.
``` js
{
Expand Down Expand Up @@ -207,6 +207,21 @@ const store = new Vuex.Store({ ...options })
To stop subscribing, call the returned unsubscribe function.
> New in 3.1.0
Since 3.1.0, `subscribeAction` can also specify whether the subscribe handler should be called *before* or *after* an action dispatch (the default behavior is *before*):
``` js
store.subscribeAction({
before: (action, state) => {
console.log(`before action ${action.type}`)
},
after: (action, state) => {
console.log(`after action ${action.type}`)
}
})
```
Most commonly used in plugins. [Details](../guide/plugins.md)
### registerModule
Expand Down

0 comments on commit 431540b

Please sign in to comment.