Class Subscription<TState, TSelected>
A subscription to a store for a selected state.
Inherited Members
Namespace: Unity.AppUI.Redux
Assembly: Unity.AppUI.Redux.dll
Syntax
public class Subscription<TState, TSelected> : SubscriptionBase<IStore<TState>, TState, TSelected>, ISubscription<TState>, IDisposableSubscription, IDisposable
Type Parameters
| Name | Description |
|---|---|
| TState | The type of the store state. |
| TSelected | The type of the selected state. |
Constructors
Subscription(Selector<TState, TSelected>, Listener<TSelected>, IStore<TState>, SubscribeOptions<TSelected>)
Create a new subscription to a store for a selected state.
Declaration
public Subscription(Selector<TState, TSelected> selector, Listener<TSelected> listener, IStore<TState> store, SubscribeOptions<TSelected> options)
Parameters
| Type | Name | Description |
|---|---|---|
| Selector<TState, TSelected> | selector | The selector to use to select the state. |
| Listener<TSelected> | listener | The listener to notify of state changes. |
| IStore<TState> | store | The store to subscribe to. |
| SubscribeOptions<TSelected> | options | The options for the subscription. |
Methods
GetStoreState(IStore<TState>)
Get the state from the store.
Declaration
protected override TState GetStoreState(IStore<TState> store)
Parameters
| Type | Name | Description |
|---|---|---|
| IStore<TState> | store | The store to get the state from. |
Returns
| Type | Description |
|---|---|
| TState | The state from the store. |
Overrides
RemoveFromStore(IStore<TState>)
Remove the subscription from the store.
Declaration
protected override bool RemoveFromStore(IStore<TState> store)
Parameters
| Type | Name | Description |
|---|---|---|
| IStore<TState> | store | The store to remove the subscription from. |
Returns
| Type | Description |
|---|---|
| bool | Whether the subscription was removed. |