esoftplay 0.0.117-e → 0.0.117-h

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/fast.ts CHANGED
@@ -1,18 +1,22 @@
1
1
  export const fastFilter = (a: any[], fn: (v: any) => boolean) => {
2
2
  let f = []; //final
3
- const al = a.length - 1
4
- for (let i = 0; i <= al; i++) {
5
- if (fn(a[i])) {
6
- f.push(a[i]);
3
+ if (a) {
4
+ const al = a.length - 1
5
+ for (let i = 0; i <= al; i++) {
6
+ if (fn(a[i])) {
7
+ f.push(a[i]);
8
+ }
7
9
  }
8
10
  }
9
11
  return f;
10
12
  };
11
13
 
12
14
  export const fastLoop = (arr: any[], func: (item: any, idx: number) => void) => {
13
- const arl = arr.length - 1
14
- for (let i = arl; i >= 0; i--) {
15
- func(arr[i], i)
15
+ if (arr) {
16
+ const arl = arr.length - 1
17
+ for (let i = arl; i >= 0; i--) {
18
+ func(arr[i], i)
19
+ }
16
20
  }
17
21
  }
18
22
 
package/global.ts CHANGED
@@ -24,6 +24,7 @@ export interface useGlobalConnect<T> {
24
24
  }
25
25
 
26
26
  _global.useGlobalUserDelete = {}
27
+ _global.useGlobalSubscriber = {}
27
28
  _global.useGlobalStateReady = 0
28
29
  class Context {
29
30
  idx = 0
@@ -139,6 +140,5 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
139
140
  }
140
141
 
141
142
  globalIdx.increment()
142
- _global.useGlobalStateReady = 1
143
143
  return { useState, get, set, useSelector, reset: del, connect: _connect };
144
144
  }
@@ -38,15 +38,6 @@ function isWorkerReady(onReady: () => void): void {
38
38
  }
39
39
  }
40
40
 
41
- function isGlobalStateReady(onReady: () => void) {
42
- const _global = require('../../_global')
43
- if (_global.useGlobalStateReady < 1) {
44
- setTimeout(() => isGlobalStateReady(onReady), 10)
45
- } else {
46
- onReady()
47
- }
48
- }
49
-
50
41
 
51
42
  export default function UserIndex(props: UserIndexProps): any {
52
43
  const [loading, setLoading] = useSafeState(true)
@@ -65,14 +56,14 @@ export default function UserIndex(props: UserIndexProps): any {
65
56
  }
66
57
 
67
58
  useLayoutEffect(() => {
68
- let limitReady = 4
59
+ let limitReady = 3
69
60
  if (Platform.OS == 'android') {
70
61
  if (Platform.Version <= 22) {
71
- limitReady = 3
62
+ limitReady = 2
72
63
  }
73
64
  }
74
65
 
75
- if (limitReady == 4) {
66
+ if (limitReady == 3) {
76
67
  isWorkerReady(() => {
77
68
  ready.current += 1
78
69
  if (ready.current >= limitReady) {
@@ -80,14 +71,7 @@ export default function UserIndex(props: UserIndexProps): any {
80
71
  }
81
72
  })
82
73
  }
83
-
84
- isGlobalStateReady(() => {
85
- ready.current += 1
86
- if (ready.current >= limitReady) {
87
- setLoading(false)
88
- }
89
- });
90
-
74
+
91
75
  (async () => {
92
76
  await setFonts()
93
77
  ready.current += 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.117-e",
3
+ "version": "0.0.117-h",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",