▸ createGlobalStore<TState>(name
, initialState
): Store
<TState>
Creates a Unistore store.
Name |
---|
TState |
Name | Type | Description |
---|---|---|
name |
string |
A name by which the store can be looked up later. Must be unique across the entire application. |
initialState |
TState |
An object which will be the initial state of the store. |
Store
<TState>
The newly created store.
▸ getAppState(): Store
<AppState>
Store
<AppState>
The store named app
.
▸ getGlobalStore<TState>(name
, fallbackState?
): Store
<TState>
Returns the existing store named name
,
or creates a new store named name
if none exists.
Name | Type |
---|---|
TState |
TState = any |
Name | Type | Description |
---|---|---|
name |
string |
The name of the store to look up. |
fallbackState? |
TState |
The initial value of the new store if no store named name exists. |
Store
<TState>
The found or newly created store.
▸ subscribeTo<T, U>(store
, select
, handle
): Unsubscribe
Name |
---|
T |
U |
Name | Type |
---|---|
store |
Store <T> |
select |
(state : T ) => U |
handle |
(subState : U ) => void |
Unsubscribe
▸ update<T>(obj
, __namedParameters
, value
): T
Name | Type |
---|---|
T |
T : Record <string, any> |
Name | Type |
---|---|
obj |
T |
__namedParameters |
string [] |
value |
any |
T