react-native-global-state-hooks 2.0.6 → 2.0.7
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/lib/GlobalStore.d.ts +20 -15
- package/lib/GlobalStore.d.ts.map +1 -1
- package/lib/GlobalStore.js +66 -74
- package/lib/GlobalStoreTypes.d.ts +4 -4
- package/lib/GlobalStoreTypes.d.ts.map +1 -1
- package/package.json +2 -1
package/lib/GlobalStore.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
1
2
|
import * as IGlobalStore from './GlobalStoreTypes';
|
|
2
|
-
export
|
|
3
|
+
export type IValueWithMedaData = {
|
|
3
4
|
_type_?: 'map' | 'set' | 'date';
|
|
4
5
|
value?: unknown;
|
|
5
6
|
};
|
|
@@ -23,25 +24,29 @@ export declare class GlobalStore<IState, IPersist extends string | null, IAction
|
|
|
23
24
|
private storedStateItem;
|
|
24
25
|
protected getAsyncStoreItemPromise: Promise<IState> | null;
|
|
25
26
|
protected asyncStorageGetItem(): Promise<string | null>;
|
|
26
|
-
protected getAsyncStoreItem(
|
|
27
|
+
protected getAsyncStoreItem({ invokerSetState }: {
|
|
28
|
+
invokerSetState?: React.Dispatch<React.SetStateAction<IState>>;
|
|
29
|
+
}): Promise<IState>;
|
|
27
30
|
protected asyncStorageSetItem(valueToStore: string): Promise<void>;
|
|
28
31
|
protected setAsyncStoreItem(): Promise<void>;
|
|
29
32
|
protected getStateCopy: () => IState;
|
|
30
33
|
getHook: <IApi extends IGlobalStore.IActionCollectionResult<IState, IActions> | null = IActions extends null ? null : IGlobalStore.IActionCollectionResult<IState, IActions>>() => () => [IState, IGlobalStore.IHookResult<IState, IActions, IApi>, IPersist extends null ? false : boolean];
|
|
31
34
|
getHookDecoupled: <IApi extends IGlobalStore.IActionCollectionResult<IState, IActions> | null = IActions extends null ? null : IGlobalStore.IActionCollectionResult<IState, IActions>>() => [() => IPersist extends string ? Promise<IState> : IState, IGlobalStore.IHookResult<IState, IActions, IApi>];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
protected
|
|
35
|
+
protected getInternalSetter: ({ invokerSetState }?: {
|
|
36
|
+
invokerSetState?: Dispatch<SetStateAction<IState>> | undefined;
|
|
37
|
+
}) => IGlobalStore.StateSetter<IState>;
|
|
38
|
+
protected getStateOrchestrator(invokerSetState?: React.Dispatch<React.SetStateAction<IState>>): IGlobalStore.StateSetter<IState> | IGlobalStore.IActionCollectionResult<IState, IActions>;
|
|
39
|
+
protected globalSetter: ({ setter, invokerSetState }: {
|
|
40
|
+
setter: IState | ((state: IState) => IState);
|
|
41
|
+
invokerSetState?: Dispatch<SetStateAction<IState>> | undefined;
|
|
42
|
+
}) => void;
|
|
43
|
+
protected globalSetterToPersistStoreAsync: ({ setter, invokerSetState }: {
|
|
44
|
+
setter: IState | ((state: IState) => IState);
|
|
45
|
+
invokerSetState?: Dispatch<SetStateAction<IState>> | undefined;
|
|
46
|
+
}) => Promise<IState>;
|
|
47
|
+
protected getApiActions: <IApi extends IGlobalStore.IActionCollectionResult<IState, IGlobalStore.IActionCollectionConfig<IState>>>({ invokerSetState }: {
|
|
48
|
+
invokerSetState?: Dispatch<SetStateAction<IState>> | undefined;
|
|
49
|
+
}) => IApi;
|
|
45
50
|
deleteAsyncStoreItem: () => Promise<void>;
|
|
46
51
|
}
|
|
47
52
|
export default GlobalStore;
|
package/lib/GlobalStore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalStore.d.ts","sourceRoot":"","sources":["../src/GlobalStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlobalStore.d.ts","sourceRoot":"","sources":["../src/GlobalStore.ts"],"names":[],"mappings":"AA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QACrD,eAAe,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;KAC/D,GAAG,OAAO,CAAC,MAAM,CAAC;cA8BH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;cAIxD,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlD,SAAS,CAAC,YAAY,QAAO,MAAM,CAAqC;IAEjE,OAAO,sRA2BZ;IAEK,gBAAgB,mLAGV,QAAQ,SAAS,MAAM,GAAG,QAAQ,MAAM,CAAC,GAAG,MAAM,oDAa7D;IAEF,SAAS,CAAC,iBAAiB;;UAElB,aAAa,WAAW,CAAC,MAAM,CAAC,CAYxC;IAED,SAAS,CAAC,oBAAoB,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,GAC/H,YAAY,CAAC,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC;IAWvD,SAAS,CAAC,YAAY;kCACM,MAAM,KAAK,MAAM;;eAgB3C;IAEF,SAAS,CAAC,+BAA+B;kCACb,MAAM,KAAK,MAAM;;UAEzC,QAAQ,MAAM,CAAC,CAMjB;IAEF,SAAS,CAAC,aAAa;;eAyBrB;IAEK,oBAAoB,QAAa,QAAQ,IAAI,CAAC,CAIpD;CAEF;AAED,eAAe,WAAW,CAAC"}
|
package/lib/GlobalStore.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.GlobalStore = exports.debounce = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const json_storage_formatter_1 = require("json-storage-formatter");
|
|
7
|
-
const async_storage_1 =
|
|
7
|
+
const async_storage_1 = tslib_1.__importDefault(require("@react-native-async-storage/async-storage"));
|
|
8
8
|
const debounce = (callback, wait = 300) => {
|
|
9
9
|
let timer;
|
|
10
10
|
return ((...args) => {
|
|
@@ -16,6 +16,9 @@ const debounce = (callback, wait = 300) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.debounce = debounce;
|
|
18
18
|
class GlobalStore {
|
|
19
|
+
get isPersistStore() {
|
|
20
|
+
return !!this.persistStoreAs;
|
|
21
|
+
}
|
|
19
22
|
constructor(state, actions = null, persistStoreAs = null,
|
|
20
23
|
/**
|
|
21
24
|
* This function can be used to format the data after it is loaded from the asyncStorage
|
|
@@ -30,91 +33,98 @@ class GlobalStore {
|
|
|
30
33
|
this.getAsyncStoreItemPromise = null;
|
|
31
34
|
this.getStateCopy = () => Object.freeze((0, json_storage_formatter_1.clone)(this.state));
|
|
32
35
|
this.getHook = () => () => {
|
|
33
|
-
const [value,
|
|
36
|
+
const [value, invokerSetState] = (0, react_1.useState)(() => this.state);
|
|
34
37
|
(0, react_1.useEffect)(() => {
|
|
35
|
-
this.subscribers.push(
|
|
38
|
+
this.subscribers.push(invokerSetState);
|
|
36
39
|
if (this.isPersistStore) {
|
|
37
|
-
this.getAsyncStoreItem();
|
|
40
|
+
this.getAsyncStoreItem({ invokerSetState });
|
|
38
41
|
}
|
|
39
42
|
return () => {
|
|
40
|
-
this.subscribers = this.subscribers.filter((hook) =>
|
|
43
|
+
this.subscribers = this.subscribers.filter((hook) => invokerSetState !== hook);
|
|
41
44
|
};
|
|
42
45
|
}, []);
|
|
43
46
|
return [
|
|
44
47
|
value,
|
|
45
|
-
this.
|
|
48
|
+
this.getStateOrchestrator(invokerSetState),
|
|
46
49
|
this.isStoredStateItemUpdated,
|
|
47
50
|
];
|
|
48
51
|
};
|
|
49
52
|
this.getHookDecoupled = () => {
|
|
50
|
-
const
|
|
53
|
+
const getState = () => {
|
|
54
|
+
if (this.isPersistStore) {
|
|
55
|
+
return this.getAsyncStoreItem({});
|
|
56
|
+
}
|
|
57
|
+
return this.state;
|
|
58
|
+
};
|
|
51
59
|
return [
|
|
52
|
-
|
|
53
|
-
this.
|
|
60
|
+
getState,
|
|
61
|
+
this.getStateOrchestrator(),
|
|
54
62
|
];
|
|
55
63
|
};
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
64
|
+
this.getInternalSetter = ({ invokerSetState } = {}) => {
|
|
65
|
+
let stateOrchestrator;
|
|
66
|
+
if (this.persistStoreAs) {
|
|
67
|
+
stateOrchestrator = this.globalSetterToPersistStoreAsync;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
stateOrchestrator = this.globalSetter;
|
|
71
|
+
}
|
|
72
|
+
return (setter) => {
|
|
73
|
+
stateOrchestrator({ invokerSetState, setter });
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
this.globalSetter = ({ setter, invokerSetState }) => {
|
|
67
77
|
const newState = typeof setter === 'function' ? setter(this.getStateCopy()) : setter;
|
|
68
78
|
this.state = newState;
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
// execute the invoke setter before the batched updates to avoid delays on the UI
|
|
80
|
+
invokerSetState === null || invokerSetState === void 0 ? void 0 : invokerSetState(newState);
|
|
81
|
+
// update all the subscribers
|
|
82
|
+
this.subscribers.forEach((setState) => {
|
|
83
|
+
if (setState === invokerSetState)
|
|
84
|
+
return;
|
|
85
|
+
setState(newState);
|
|
86
|
+
});
|
|
72
87
|
};
|
|
73
|
-
this.globalSetterToPersistStoreAsync = (setter) =>
|
|
74
|
-
this.globalSetter(setter);
|
|
88
|
+
this.globalSetterToPersistStoreAsync = ({ setter, invokerSetState }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
this.globalSetter({ invokerSetState, setter });
|
|
75
90
|
yield this.setAsyncStoreItem();
|
|
76
91
|
return this.state;
|
|
77
92
|
});
|
|
78
|
-
this.
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return promise;
|
|
88
|
-
};
|
|
89
|
-
const result = actions[key](...parameres)(setterWrapper, this.getStateCopy());
|
|
90
|
-
const resultPromise = Promise.resolve(result) === result ? result : Promise.resolve();
|
|
91
|
-
yield Promise.all([promise, resultPromise]);
|
|
93
|
+
this.getApiActions = ({ invokerSetState }) => {
|
|
94
|
+
const actionsConfig = this.actions;
|
|
95
|
+
const actionsKeys = Object.keys(actionsConfig);
|
|
96
|
+
const internalSetter = this.getInternalSetter({ invokerSetState });
|
|
97
|
+
const actionsApi = actionsKeys.reduce((accumulator, key) => (Object.assign(Object.assign({}, accumulator), { [key]: (...parameres) => {
|
|
98
|
+
const actionConfig = actionsConfig[key];
|
|
99
|
+
const action = actionConfig(...parameres);
|
|
100
|
+
// executes the actions bringing access to the state setter and a copy of the state
|
|
101
|
+
const result = action(internalSetter, this.getStateCopy());
|
|
92
102
|
return result;
|
|
93
|
-
}
|
|
103
|
+
} })), {});
|
|
104
|
+
return actionsApi;
|
|
94
105
|
};
|
|
95
|
-
this.deleteAsyncStoreItem = () =>
|
|
106
|
+
this.deleteAsyncStoreItem = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
96
107
|
if (!this.isPersistStore)
|
|
97
108
|
return;
|
|
98
109
|
yield async_storage_1.default.removeItem(this.persistStoreAs);
|
|
99
110
|
});
|
|
100
111
|
}
|
|
101
|
-
get isPersistStore() {
|
|
102
|
-
return !!this.persistStoreAs;
|
|
103
|
-
}
|
|
104
112
|
get isStoredStateItemUpdated() {
|
|
105
113
|
return this.storedStateItem !== undefined;
|
|
106
114
|
}
|
|
107
115
|
asyncStorageGetItem() {
|
|
108
116
|
return async_storage_1.default.getItem(this.persistStoreAs);
|
|
109
117
|
}
|
|
110
|
-
getAsyncStoreItem() {
|
|
111
|
-
return
|
|
118
|
+
getAsyncStoreItem({ invokerSetState }) {
|
|
119
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
// If the state is already updated, return it
|
|
112
121
|
if (this.isStoredStateItemUpdated)
|
|
113
122
|
return this.storedStateItem;
|
|
123
|
+
// If the promise to get the state is already running, return it
|
|
114
124
|
if (this.getAsyncStoreItemPromise)
|
|
115
125
|
return this.getAsyncStoreItemPromise;
|
|
116
126
|
this.getAsyncStoreItemPromise = new Promise((resolve) => {
|
|
117
|
-
(() =>
|
|
127
|
+
(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
118
128
|
var _a;
|
|
119
129
|
const item = yield this.asyncStorageGetItem();
|
|
120
130
|
if (item) {
|
|
@@ -122,7 +132,8 @@ class GlobalStore {
|
|
|
122
132
|
/** This allow users to review what is been stored */
|
|
123
133
|
value = (_a = this.onPersistStorageLoad(value)) !== null && _a !== void 0 ? _a : value;
|
|
124
134
|
const newState = (0, json_storage_formatter_1.formatFromStore)(value);
|
|
125
|
-
|
|
135
|
+
const stateSetter = this.getInternalSetter({ invokerSetState });
|
|
136
|
+
stateSetter(newState);
|
|
126
137
|
}
|
|
127
138
|
resolve(this.state);
|
|
128
139
|
}))();
|
|
@@ -131,12 +142,12 @@ class GlobalStore {
|
|
|
131
142
|
});
|
|
132
143
|
}
|
|
133
144
|
asyncStorageSetItem(valueToStore) {
|
|
134
|
-
return
|
|
145
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
135
146
|
yield async_storage_1.default.setItem(this.persistStoreAs, valueToStore);
|
|
136
147
|
});
|
|
137
148
|
}
|
|
138
149
|
setAsyncStoreItem() {
|
|
139
|
-
return
|
|
150
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
140
151
|
if (this.storedStateItem === this.state)
|
|
141
152
|
return;
|
|
142
153
|
this.storedStateItem = this.state;
|
|
@@ -144,33 +155,14 @@ class GlobalStore {
|
|
|
144
155
|
yield this.asyncStorageSetItem(JSON.stringify(valueToStore));
|
|
145
156
|
});
|
|
146
157
|
}
|
|
147
|
-
|
|
148
|
-
if (this._stateOrchestrator)
|
|
149
|
-
return this._stateOrchestrator;
|
|
158
|
+
getStateOrchestrator(invokerSetState) {
|
|
150
159
|
if (this.actions) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
this._stateOrchestrator = this.globalSetterToPersistStoreAsync;
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
this._stateOrchestrator = this.globalSetter;
|
|
160
|
+
return this.getApiActions({
|
|
161
|
+
invokerSetState,
|
|
162
|
+
});
|
|
158
163
|
}
|
|
159
|
-
return this.
|
|
164
|
+
return this.getInternalSetter({ invokerSetState });
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
167
|
exports.GlobalStore = GlobalStore;
|
|
163
|
-
/**
|
|
164
|
-
** [subscriber-update-callback, hook]
|
|
165
|
-
*/
|
|
166
|
-
GlobalStore.batchedUpdates = [];
|
|
167
|
-
/**
|
|
168
|
-
* React native cannot use unstable_batchedUpdates
|
|
169
|
-
*/
|
|
170
|
-
GlobalStore.ExecutePendingBatches = () => {
|
|
171
|
-
GlobalStore.batchedUpdates.forEach(([execute]) => {
|
|
172
|
-
execute();
|
|
173
|
-
});
|
|
174
|
-
GlobalStore.batchedUpdates = [];
|
|
175
|
-
};
|
|
176
168
|
exports.default = GlobalStore;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @param {StateSetter<IState>} setter - add a new value to the state
|
|
3
3
|
* @returns {void} result - void
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type StateSetter<IState> = (setter: IState | ((state: IState) => IState)) => void;
|
|
6
6
|
/**
|
|
7
7
|
* This is the structure required by the API actions in order to be able to capture action parameters and inject state setter into actions.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type IActionConfig<IState> = (...params: any[]) => (setter: StateSetter<IState>, currentState: IState) => unknown;
|
|
10
10
|
/**
|
|
11
11
|
* Configuration of you API
|
|
12
12
|
*/
|
|
@@ -16,13 +16,13 @@ export interface IActionCollectionConfig<IState> {
|
|
|
16
16
|
/**
|
|
17
17
|
* This is the API result of the hook (if you passed an API as a parameter)
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type IActionCollectionResult<IState, IActions extends IActionCollectionConfig<IState> | null> = {
|
|
20
20
|
[key in keyof IActions]: (...params: any[]) => unknown;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
23
|
* Hook result, if you passed an API as a parameter it will be returned in the second position of the hook invoke.
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type IHookResult<IState, IActions extends IActionCollectionConfig<IState> | null = null, IApi extends IActionCollectionResult<IState, IActions> | null = IActions extends null ? null : IActionCollectionResult<IState, IActions>> = IApi extends null ? StateSetter<IState> : IActions extends IActionCollectionConfig<IState> ? IApi extends IActionCollectionResult<IState, IActions> ? IApi : StateSetter<IState> : StateSetter<IState>;
|
|
26
26
|
/**
|
|
27
27
|
* This is a class to create global-store objects
|
|
28
28
|
* @template IState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalStoreTypes.d.ts","sourceRoot":"","sources":["../src/GlobalStoreTypes.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF,
|
|
1
|
+
{"version":3,"file":"GlobalStoreTypes.d.ts","sourceRoot":"","sources":["../src/GlobalStoreTypes.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF,MAAM,MAAM,WAAW,CAAC,MAAM,IAAI,CAChC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,KACzC,IAAI,CAAC;AAEV;;EAEE;AACF,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,CAElC,GAAG,MAAM,EAAE,GAAG,EAAE,KACb,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AAEpE;;EAEE;AACF,MAA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B,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO,MAAM;QAC/I,MAAM;QACN,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;QACnC,QAAQ,SAAS,IAAI,GAAG,KAAK,GAAG,IAAI,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI;KACnE,CAAC;IAEF;;;;MAIE;IACF,gBAAgB,EAAE,CAAC,IAAI,SAAS,QAAQ,SAAS,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO;QAClJ,MAAM,QAAQ,SAAS,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;QACxD,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;KACpC,CAAC;IAEF,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-global-state-hooks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "This is a package to easily handling global-state across your react-native-components No-redux",
|
|
5
5
|
"main": "lib/GlobalStore.js",
|
|
6
6
|
"files": [
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"react": "workspace:*",
|
|
59
59
|
"react-test-renderer": "^17.0.1",
|
|
60
60
|
"ts-jest": "^26.4.4",
|
|
61
|
+
"tslib": "^2.5.0",
|
|
61
62
|
"typescript": "^4.1.2"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|