esoftplay 0.0.116-a → 0.0.116-d
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/bin/router.js +2 -2
- package/modules/lib/worker.tsx +2 -9
- package/modules/user/index.tsx +16 -7
- package/package.json +1 -1
package/bin/router.js
CHANGED
|
@@ -588,12 +588,12 @@ function createRouter() {
|
|
|
588
588
|
if (HookModules.includes(nav)) {
|
|
589
589
|
item += "" +
|
|
590
590
|
"import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../." + Modules[module][task] + "';\n" +
|
|
591
|
-
"
|
|
591
|
+
"var " + ucword(module) + ucword(task) + " = React.memo(_" + ucword(module) + ucword(task) + ", isEqual); \n" +
|
|
592
592
|
"export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
|
|
593
593
|
} else if (UseLibs.includes(nav)) {
|
|
594
594
|
item += "" +
|
|
595
595
|
"import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../." + Modules[module][task] + "';\n" +
|
|
596
|
-
"
|
|
596
|
+
"var " + ucword(module) + ucword(task) + " = _" + ucword(module) + ucword(task) + "; \n" +
|
|
597
597
|
"export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
|
|
598
598
|
} else {
|
|
599
599
|
item += "export { _" + ucword(module) + ucword(task) + " as " + ucword(module) + ucword(task) + " };\n"
|
package/modules/lib/worker.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// noPage
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { _global } from 'esoftplay';
|
|
4
4
|
import React, { Component } from "react";
|
|
5
5
|
import { Platform } from 'react-native';
|
|
6
|
-
import useGlobalState from '../../global';
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
export interface LibWorkerInit {
|
|
@@ -23,16 +22,11 @@ _global.LibWorkerTasks = new Map()
|
|
|
23
22
|
_global.injectedJavaScripts = []
|
|
24
23
|
_global.LibWorkerReady = 0
|
|
25
24
|
_global.LibWorkerCount = 0
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
export default class m extends Component<LibWorkerProps, LibWorkerState> {
|
|
28
27
|
constructor(props: LibWorkerProps) {
|
|
29
28
|
super(props)
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
static workerState(): useGlobalReturn<any> {
|
|
33
|
-
return state
|
|
34
|
-
}
|
|
35
|
-
|
|
36
30
|
static delete(taskId: string): void {
|
|
37
31
|
_global.LibWorkerTasks.delete(taskId)
|
|
38
32
|
}
|
|
@@ -158,7 +152,6 @@ export default class m extends Component<LibWorkerProps, LibWorkerState> {
|
|
|
158
152
|
return (e: any) => {
|
|
159
153
|
if (e.nativeEvent.data == withRefName) {
|
|
160
154
|
_global.LibWorkerReady += 1
|
|
161
|
-
m.workerState().set(1)
|
|
162
155
|
return
|
|
163
156
|
}
|
|
164
157
|
const dt = e.nativeEvent.data
|
package/modules/user/index.tsx
CHANGED
|
@@ -29,10 +29,17 @@ function setFonts(): Promise<void> {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
function isWorkerReady(onReady: () => void): void {
|
|
33
|
+
if (_global.LibWorkerReady < 1) {
|
|
34
|
+
setTimeout(() => isWorkerReady(onReady), 30)
|
|
35
|
+
} else {
|
|
36
|
+
onReady()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
|
|
33
41
|
export default function UserIndex(props: UserIndexProps): any {
|
|
34
42
|
const [loading, setLoading] = useSafeState(true)
|
|
35
|
-
const [worker] = LibWorker.workerState().useState()
|
|
36
43
|
const user = UserClass.state().useSelector(s => s)
|
|
37
44
|
const ready = React.useRef(0)
|
|
38
45
|
UseDeeplink()
|
|
@@ -57,11 +64,13 @@ export default function UserIndex(props: UserIndexProps): any {
|
|
|
57
64
|
limitReady = 2
|
|
58
65
|
}
|
|
59
66
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
if (limitReady == 3) {
|
|
68
|
+
isWorkerReady(() => {
|
|
69
|
+
ready.current += 1
|
|
70
|
+
if (ready.current >= limitReady) {
|
|
71
|
+
setLoading(false)
|
|
72
|
+
}
|
|
73
|
+
})
|
|
65
74
|
}
|
|
66
75
|
(async () => {
|
|
67
76
|
await setFonts()
|
|
@@ -86,7 +95,7 @@ export default function UserIndex(props: UserIndexProps): any {
|
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
97
|
LibUpdaterProperty.check((isNew) => { })
|
|
89
|
-
}, [
|
|
98
|
+
}, [])
|
|
90
99
|
|
|
91
100
|
useEffect(() => {
|
|
92
101
|
if (!loading) {
|