Skip to content

Commit 3a093d8

Browse files
committed
docs: API for subscribeAction
1 parent 71aeaec commit 3a093d8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/en/api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ const store = new Vuex.Store({ ...options })
156156
157157
Most commonly used in plugins. [Details](plugins.md)
158158
159+
- **`subscribeAction(handler: Function)`**
160+
161+
> New in 2.5.0
162+
163+
Subscribe to store actions. The `handler` is called for every dispatched action and receives the action descriptor and current store state as arguments:
164+
165+
``` js
166+
store.subscribeAction((action, state) => {
167+
console.log(action.type)
168+
console.log(action.payload)
169+
})
170+
```
171+
172+
Most commonly used in plugins. [Details](plugins.md)
173+
159174
- **`registerModule(path: string | Array<string>, module: Module, options?: Object)`**
160175
161176
Register a dynamic module. [Details](modules.md#dynamic-module-registration)

0 commit comments

Comments
 (0)