@braine/statemanagement 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -0
- package/dist/index.cjs +1706 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +1683 -0
- package/package.json +48 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare function subscribe(store: object, callback: (target: any, prop: any, value: any) => void): () => boolean;
|
|
2
|
+
declare function createState<T extends object>(initialState: T): T;
|
|
3
|
+
|
|
4
|
+
declare function useStore<T extends object>(store: T): T;
|
|
5
|
+
|
|
6
|
+
declare function scheduleUpdate(callback: () => void): void;
|
|
7
|
+
|
|
8
|
+
declare function enableDevTools(store: any, name?: string): void;
|
|
9
|
+
|
|
10
|
+
declare function computed<T>(fn: () => T): {
|
|
11
|
+
readonly value: T;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare function isPromise(value: any): value is Promise<any>;
|
|
15
|
+
declare function handlePromise(promise: Promise<any>, triggerUpdate: () => void): void;
|
|
16
|
+
declare function unwrapPromise(promise: Promise<any>): any;
|
|
17
|
+
declare function getPromiseState(promise: Promise<any>): {
|
|
18
|
+
status: "pending" | "fulfilled" | "rejected";
|
|
19
|
+
value: any;
|
|
20
|
+
error: any;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { computed, createState, enableDevTools, getPromiseState, handlePromise, isPromise, scheduleUpdate, subscribe, unwrapPromise, useStore };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare function subscribe(store: object, callback: (target: any, prop: any, value: any) => void): () => boolean;
|
|
2
|
+
declare function createState<T extends object>(initialState: T): T;
|
|
3
|
+
|
|
4
|
+
declare function useStore<T extends object>(store: T): T;
|
|
5
|
+
|
|
6
|
+
declare function scheduleUpdate(callback: () => void): void;
|
|
7
|
+
|
|
8
|
+
declare function enableDevTools(store: any, name?: string): void;
|
|
9
|
+
|
|
10
|
+
declare function computed<T>(fn: () => T): {
|
|
11
|
+
readonly value: T;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare function isPromise(value: any): value is Promise<any>;
|
|
15
|
+
declare function handlePromise(promise: Promise<any>, triggerUpdate: () => void): void;
|
|
16
|
+
declare function unwrapPromise(promise: Promise<any>): any;
|
|
17
|
+
declare function getPromiseState(promise: Promise<any>): {
|
|
18
|
+
status: "pending" | "fulfilled" | "rejected";
|
|
19
|
+
value: any;
|
|
20
|
+
error: any;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { computed, createState, enableDevTools, getPromiseState, handlePromise, isPromise, scheduleUpdate, subscribe, unwrapPromise, useStore };
|