Method Subscribe
Subscribe<TState>(string, Action<TState>)
Adds a change listener. It will be called any time an action is dispatched, and some part of the state tree may potentially have changed.
Declaration
public Unsubscriber Subscribe<TState>(string name, Action<TState> listener)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the state slice. |
| Action<TState> | listener | A callback to be invoked on every dispatch. |
Returns
| Type | Description |
|---|---|
| Unsubscriber | A function to remove this change listener. |
Type Parameters
| Name | Description |
|---|---|
| TState | The type of the state. |
Remarks
This method doesn't check for duplicate listeners, so calling it multiple times with the same listener will result in the listener being called multiple times.