Interface IStore<TState>
The global state management
Namespace: Onbox.Store.V8
Assembly: Onbox.Store.dll
Syntax
public interface IStore<TState>
where TState : class, new()
Type Parameters
Name | Description |
---|---|
TState | The type of the global state |
Methods
| Improve this Doc View SourceDisableLogging()
Disables logging of the state when actions are dispatched
Declaration
void DisableLogging()
EnableLogging()
Enable logging of the state when actions are dispatched
Declaration
void EnableLogging()
GetHistory()
Gets the complete history of the global state
Declaration
List<StateEntry<TState>> GetHistory()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<StateEntry<TState>> |
Select<TSlice>(IStoreAction<TState, TSlice>)
Selects a specific slice of the global state
Declaration
TSlice Select<TSlice>(IStoreAction<TState, TSlice> action)
where TSlice : class, new()
Parameters
Type | Name | Description |
---|---|---|
IStoreAction<TState, TSlice> | action | The action responsible for the slice |
Returns
Type | Description |
---|---|
TSlice |
Type Parameters
Name | Description |
---|---|
TSlice | The type of the slice |
SetState<TSlice>(IStoreAction<TState, TSlice>, TSlice)
Sets a specific slice of the global state
Declaration
void SetState<TSlice>(IStoreAction<TState, TSlice> action, TSlice state)
where TSlice : class, new()
Parameters
Type | Name | Description |
---|---|---|
IStoreAction<TState, TSlice> | action | The action responsible for the slice |
TSlice | state | The new state to be dispatched |
Type Parameters
Name | Description |
---|---|
TSlice | The type of the slice that will be changed |
Subscribe<TSlice>(IStoreAction<TState, TSlice>, Action<TSlice>)
Subscribe to a specifc slice of the global state
Declaration
IStorageSubscription Subscribe<TSlice>(IStoreAction<TState, TSlice> action, Action<TSlice> callback)
where TSlice : class, new()
Parameters
Type | Name | Description |
---|---|---|
IStoreAction<TState, TSlice> | action | The action responsible for the slice |
System.Action<TSlice> | callback | The callback perfomerd when the slice is changed |
Returns
Type | Description |
---|---|
IStorageSubscription |
Type Parameters
Name | Description |
---|---|
TSlice | The type of the slice |