esoftplay 0.0.136-p → 0.0.136-r
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/global.ts +2 -1
- package/modules/user/data.ts +2 -0
- package/moment.ts +0 -1
- package/package.json +1 -1
package/global.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface useGlobalOption {
|
|
|
33
33
|
export interface useGlobalConnect<T> {
|
|
34
34
|
render: (props: T) => any,
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
export let userDataReset: Function[] = []
|
|
37
37
|
let timeoutFinish: NodeJS.Timeout
|
|
38
38
|
export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): useGlobalReturn<T> {
|
|
39
39
|
let STORAGE: any = undefined
|
|
@@ -121,6 +121,7 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
121
121
|
/* register to userData to automatically reset state and persist */
|
|
122
122
|
if (o?.isUserData) {
|
|
123
123
|
if (o?.persistKey) {
|
|
124
|
+
userDataReset.push(del)
|
|
124
125
|
const UserData = esp?.mod?.("user/data")
|
|
125
126
|
if (UserData)
|
|
126
127
|
UserData?.register?.(o?.persistKey)
|
package/modules/user/data.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// noPage
|
|
2
2
|
// withObject
|
|
3
3
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
|
+
import { userDataReset } from 'esoftplay/global';
|
|
4
5
|
import FastStorage from 'esoftplay/mmkv';
|
|
5
6
|
import Storage from 'esoftplay/storage';
|
|
6
7
|
|
|
@@ -27,6 +28,7 @@ export default {
|
|
|
27
28
|
deleteAll(): void {
|
|
28
29
|
AsyncStorage.getItem("user_data_dependent").then((x) => {
|
|
29
30
|
if (x) {
|
|
31
|
+
userDataReset.forEach((f) => f())
|
|
30
32
|
const arx = JSON.parse(x)
|
|
31
33
|
AsyncStorage.multiRemove(arx)
|
|
32
34
|
arx.forEach((ix) => { FastStorage.removeItem(ix) })
|
package/moment.ts
CHANGED