-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
38 lines (21 loc) · 909 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export as namespace ORState;
export function createStateObject<T>(initialState: any): StateService<T>;
export function createStateManager<T, U extends StateService<T>>(stateService: U): [T, U];
export function createSimpleState<T>(stateService: StateService<T>): [T, (nextState: T) => void];
export function createStateObjectStore<T>(initialState: T): StateObjectStore<T>;
export interface StateService<T> {
stateObject: BehaviorSubject<T>,
subscribe: (setState: React.Dispatch<React.SetStateAction<T>>) => Subscription,
set: (nextState: T) => void
clear: () => void
}
export interface StoreStateService<T> {
id: string,
state: StateService<T>
}
export interface StateObjectStore<T> {
store: StoreStateService<T>[]
get: (id: string) => StateService<T> | undefined
add: (stateObject: StateService<T>, id: string) => void,
remove: (id: string) => void
}