Interface INotifiable<TState>
Interface for a store that can notify subscribers of state changes.
Namespace: Unity.AppUI.Redux
Assembly: Unity.AppUI.Redux.dll
Syntax
public interface INotifiable<out TState>
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |
Methods
NotifySubscribers()
Notify the subscribers of a new state.
Declaration
void NotifySubscribers()
Subscribe<TSelected>(Selector<TState, TSelected>, Listener<TSelected>, SubscribeOptions<TSelected>)
Subscribe to a state change and listen to a specific part of the state.
Declaration
IDisposableSubscription Subscribe<TSelected>(Selector<out TState, TSelected> selector, Listener<TSelected> listener, SubscribeOptions<TSelected> options = default)
Parameters
Type | Name | Description |
---|---|---|
Selector<TState, TSelected> | selector | The selector to get the selected part of the state. |
Listener<TSelected> | listener | The listener to be invoked on every dispatch. |
Subscribe |
options | The options for the subscription. |
Returns
Type | Description |
---|---|
IDisposable |
A Subscription object that can be disposed. |
Type Parameters
Name | Description |
---|---|
TSelected | The type of the selected part of the state. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the selector or listener is null. |
Unsubscribe(ISubscription<TState>)
Remove a subscription from the store.
Declaration
bool Unsubscribe(ISubscription<out TState> subscription)
Parameters
Type | Name | Description |
---|---|---|
ISubscription<TState> | subscription | The subscription to remove. |
Returns
Type | Description |
---|---|
bool | True if the subscription was removed, false otherwise. |