Class Store<TState>
The global state management
Inheritance
System.Object
Store<TState>
Implements
IStore<TState>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Onbox.Store.V8
Assembly: Onbox.Store.dll
Syntax
public class Store<TState> : IStore<TState> where TState : class, new()
Type Parameters
Name | Description |
---|---|
TState | The type of the global state |
Constructors
| Improve this Doc View SourceStore(IMapper, ILoggingService, IJsonService)
The constructor for this implementation of state management
Declaration
public Store(IMapper mapper, ILoggingService logging, IJsonService jsonService)
Parameters
Type | Name | Description |
---|---|---|
IMapper | mapper | |
ILoggingService | logging | |
IJsonService | jsonService |
Methods
| Improve this Doc View SourceDisableLogging()
Disables logging of the state when actions are dispatched
Declaration
public void DisableLogging()
EnableLogging()
Enable logging of the state when actions are dispatched
Declaration
public void EnableLogging()
GetHistory()
Gets the complete history of the global state
Declaration
public 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
public 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
public void SetState<TSlice>(IStoreAction<TState, TSlice> action, TSlice slice)
where TSlice : class, new()
Parameters
Type | Name | Description |
---|---|---|
IStoreAction<TState, TSlice> | action | The action responsible for the slice |
TSlice | slice | 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
public 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 |