Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/en/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ const store = new Vuex.Store({ ...options })

Replace the store's root state. Use this only for state hydration / time-travel purposes.

- **`watch(getter: Function, cb: Function, options?: Object)`**
- **`watch(fn: Function, callback: Function, options?: Object): Function`**

Reactively watch a getter function's return value, and call the callback when the value changes. The getter receives the store's state as the first argument, and getters as the second argument. Accepts an optional options object that takes the same options as Vue's `vm.$watch` method.
Reactively watch `fn`'s return value, and call the callback when the value changes. `fn` receives the store's state as the first argument, and getters as the second argument. Accepts an optional options object that takes the same options as Vue's `vm.$watch` method.

To stop watching, call the returned handle function.
To stop watching, call the returned unwatch function.

- **`subscribe(handler: Function)`**
- **`subscribe(handler: Function): Function`**

Subscribe to store mutations. The `handler` is called after every mutation and receives the mutation descriptor and post-mutation state as arguments:

Expand All @@ -157,9 +157,11 @@ const store = new Vuex.Store({ ...options })
})
```

To stop subscribing, call the returned unsubscribe function.

Most commonly used in plugins. [Details](plugins.md)

- **`subscribeAction(handler: Function)`**
- **`subscribeAction(handler: Function): Function`**

> New in 2.5.0

Expand All @@ -172,6 +174,8 @@ const store = new Vuex.Store({ ...options })
})
```

To stop subscribing, call the returned unsubscribe function.

Most commonly used in plugins. [Details](plugins.md)

- **`registerModule(path: string | Array<string>, module: Module, options?: Object)`**
Expand Down