Skip to content

Commit 431540b

Browse files
committed
docs: document new subscribeAction options
1 parent acd7249 commit 431540b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/api/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const store = new Vuex.Store({ ...options })
120120
121121
- type: `Boolean`
122122
123-
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.
123+
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.
124124
125125
``` js
126126
{
@@ -207,6 +207,21 @@ const store = new Vuex.Store({ ...options })
207207
208208
To stop subscribing, call the returned unsubscribe function.
209209
210+
> New in 3.1.0
211+
212+
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*):
213+
214+
``` js
215+
store.subscribeAction({
216+
before: (action, state) => {
217+
console.log(`before action ${action.type}`)
218+
},
219+
after: (action, state) => {
220+
console.log(`after action ${action.type}`)
221+
}
222+
})
223+
```
224+
210225
Most commonly used in plugins. [Details](../guide/plugins.md)
211226
212227
### registerModule

0 commit comments

Comments
 (0)