esoftplay 0.0.140-a → 0.0.140-c

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/cli.js CHANGED
@@ -87,6 +87,7 @@ switch (args[0]) {
87
87
  break
88
88
  case "b":
89
89
  case "build":
90
+ buildPrepare(false)
90
91
  buildPrepare(true)
91
92
  build()
92
93
  break;
package/global.ts CHANGED
@@ -31,7 +31,8 @@ export interface useGlobalOption {
31
31
  }
32
32
 
33
33
  export interface useGlobalConnect<T> {
34
- render: (props: T) => any,
34
+ selector?: (props: T) => any,
35
+ render: (props: any) => any,
35
36
  }
36
37
  export let userDataReset: Function[] = []
37
38
  let timeoutFinish: NodeJS.Timeout
@@ -225,7 +226,7 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
225
226
  };
226
227
 
227
228
  function _connect(props: useGlobalConnect<T>): any {
228
- const [state] = useState()
229
+ const state = props.selector ? useSelector(props.selector) : useState()[0]
229
230
  const children = props.render(state)
230
231
  return children ? R.cloneElement(children) : null
231
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.140-a",
3
+ "version": "0.0.140-c",
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",
package/subscribe.ts CHANGED
@@ -22,10 +22,6 @@ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscr
22
22
  value = defaultValue;
23
23
  }
24
24
 
25
- const trigger = (newValue?: any) => {
26
- notify(newValue);
27
- }
28
-
29
25
  function useSubscribe(func: Function) {
30
26
  React.useLayoutEffect(() => {
31
27
  subscribers.add(func)
@@ -35,7 +31,7 @@ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscr
35
31
  }
36
32
  }, [])
37
33
 
38
- return trigger;
34
+ return notify;
39
35
  }
40
36
 
41
37
  function notify(newValue?: any) {
@@ -51,6 +47,6 @@ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscr
51
47
  getValue,
52
48
  useSubscribe,
53
49
  reset,
54
- trigger
50
+ trigger: notify
55
51
  };
56
52
  }