1
0
Эх сурвалжийг харах

docs: API for subscribeAction

Evan You 7 жил өмнө
parent
commit
3a093d8f38
1 өөрчлөгдсөн 15 нэмэгдсэн , 0 устгасан
  1. 15 0
      docs/en/api.md

+ 15 - 0
docs/en/api.md

@@ -156,6 +156,21 @@ const store = new Vuex.Store({ ...options })
 
   Most commonly used in plugins. [Details](plugins.md)
 
+- **`subscribeAction(handler: Function)`**
+
+  > New in 2.5.0
+
+  Subscribe to store actions. The `handler` is called for every dispatched action and receives the action descriptor and current store state as arguments:
+
+  ``` js
+  store.subscribeAction((action, state) => {
+    console.log(action.type)
+    console.log(action.payload)
+  })
+  ```
+
+  Most commonly used in plugins. [Details](plugins.md)
+
 - **`registerModule(path: string | Array<string>, module: Module, options?: Object)`**
 
   Register a dynamic module. [Details](modules.md#dynamic-module-registration)