Class StoreFactory
Factory methods to create Redux stores.
Inherited Members
Namespace: Unity.AppUI.Redux
Assembly: Unity.AppUI.Redux.dll
Syntax
public static class StoreFactory
Methods
ApplyMiddleware<TState>(params Middleware<TState>[])
Apply middlewares to the store.
Declaration
public static StoreEnhancer<TState> ApplyMiddleware<TState>(params Middleware<TState>[] middlewares)
Parameters
Type | Name | Description |
---|---|---|
Middleware<TState>[] | middlewares | The middlewares to apply. |
Returns
Type | Description |
---|---|
Store |
A new store enhancer. |
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |
CombineReducers<TState>(IEnumerable<Reducer<TState>>)
Create a reducer that combines multiple reducers into one.
Declaration
public static Reducer<TState> CombineReducers<TState>(IEnumerable<Reducer<TState>> reducers)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Reducer<TState>> | reducers | The reducers to combine. |
Returns
Type | Description |
---|---|
Reducer<TState> | A reducer that combines the given reducers. |
Type Parameters
Name | Description |
---|---|
TState | The type of the state. |
CombineReducers<TState>(IReadOnlyCollection<ISlice<TState>>)
Create a reducer that combines multiple slices into one.
Declaration
public static Reducer<TState> CombineReducers<TState>(IReadOnlyCollection<ISlice<TState>> slices)
Parameters
Type | Name | Description |
---|---|---|
IRead |
slices | The slices to combine. |
Returns
Type | Description |
---|---|
Reducer<TState> | A reducer that combines the given slices. |
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |
CombineReducers<TState>(params Reducer<TState>[])
Create a reducer that combines multiple reducers into one.
Declaration
public static Reducer<TState> CombineReducers<TState>(params Reducer<TState>[] reducers)
Parameters
Type | Name | Description |
---|---|---|
Reducer<TState>[] | reducers | The reducers to combine. |
Returns
Type | Description |
---|---|
Reducer<TState> | A reducer that combines the given reducers. |
Type Parameters
Name | Description |
---|---|
TState | The type of the state. |
ComposeEnhancers<TState>(params StoreEnhancer<TState>[])
Compose enhancers into a single enhancer.
Declaration
public static StoreEnhancer<TState> ComposeEnhancers<TState>(params StoreEnhancer<TState>[] enhancers)
Parameters
Type | Name | Description |
---|---|---|
Store |
enhancers | The enhancers to compose. |
Returns
Type | Description |
---|---|
Store |
A new store enhancer. |
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |
CreateSlice<TState>(string, TState, Action<SliceReducerSwitchBuilder<TState>>, Action<ReducerSwitchBuilder<TState>>)
Create a new state slice. A state slice is a part of the state tree. You can provide reducers that will "own" the state slice at the same time.
Declaration
public static Slice<TState, PartitionedState> CreateSlice<TState>(string name, TState initialState, Action<SliceReducerSwitchBuilder<TState>> reducers, Action<ReducerSwitchBuilder<TState>> extraReducers = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the state slice. |
TState | initialState | The initial state of the state slice. |
Action<Slice |
reducers | The reducers that will "own" the state slice. |
Action<Reducer |
extraReducers | The reducers that will be called if the action type does not match any of the main reducers. |
Returns
Type | Description |
---|---|
Slice<TState, Partitioned |
A slice object that can be used to access the state slice. |
Type Parameters
Name | Description |
---|---|
TState | The type of the slice state. |
Remarks
You can also provide extra reducers that will be called if the action type does not match any of the main reducers.
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the name is null or empty. |
CreateStore(IReadOnlyCollection<ISlice<PartitionedState>>, StoreEnhancer<PartitionedState>)
Creates a Redux store composed of multiple slices.
Declaration
public static IStore<PartitionedState> CreateStore(IReadOnlyCollection<ISlice<PartitionedState>> slices, StoreEnhancer<PartitionedState> enhancer = null)
Parameters
Type | Name | Description |
---|---|---|
IRead |
slices | The slices that compose the store. |
Store |
enhancer | The enhancer for the store. |
Returns
Type | Description |
---|---|
IStore<Partitioned |
The new store. |
Remarks
This is a specialization of
Create
CreateStore(Reducer<PartitionedState>, PartitionedState, StoreEnhancer<PartitionedState>)
Creates a Redux store that holds the complete state tree of your app.
Declaration
public static IStore<PartitionedState> CreateStore(Reducer<PartitionedState> rootReducer, PartitionedState initialState = null, StoreEnhancer<PartitionedState> enhancer = null)
Parameters
Type | Name | Description |
---|---|---|
Reducer<Partitioned |
rootReducer | The root reducer of the store. |
Partitioned |
initialState | The initial state of the store. |
Store |
enhancer | The enhancer for the store. |
Returns
Type | Description |
---|---|
IStore<Partitioned |
A new store. |
Remarks
This is a specialization of
Create
CreateStore<TState>(IReadOnlyCollection<ISlice<TState>>, StoreEnhancer<TState>)
Creates a Redux store composed of multiple slices.
Declaration
public static IStore<TState> CreateStore<TState>(IReadOnlyCollection<ISlice<TState>> slices, StoreEnhancer<TState> enhancer = null) where TState : IPartionableState<TState>, new()
Parameters
Type | Name | Description |
---|---|---|
IRead |
slices | The slices that compose the store. |
Store |
enhancer | The enhancer for the store. |
Returns
Type | Description |
---|---|
IStore<TState> | The new store. |
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the slices are null. |
CreateStore<TState>(Reducer<TState>, TState, StoreEnhancer<TState>)
Creates a Redux store that holds the complete state tree of your app.
Declaration
public static IStore<TState> CreateStore<TState>(Reducer<TState> rootReducer, TState initialState = default, StoreEnhancer<TState> enhancer = null) where TState : new()
Parameters
Type | Name | Description |
---|---|---|
Reducer<TState> | rootReducer | The root reducer of the store. |
TState | initialState | The initial state of the store. |
Store |
enhancer | The enhancer for the store. |
Returns
Type | Description |
---|---|
IStore<TState> | A new store. |
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |
DefaultEnhancer<TState>(DefaultEnhancerConfiguration)
Get the default enhancer for the store.
Declaration
public static StoreEnhancer<TState> DefaultEnhancer<TState>(DefaultEnhancerConfiguration cfg = null)
Parameters
Type | Name | Description |
---|---|---|
Default |
cfg | The configuration for the default enhancer. |
Returns
Type | Description |
---|---|
Store |
The default enhancer. |
Type Parameters
Name | Description |
---|---|
TState | The type of the store state. |