chem-rx 0.0.6 → 0.0.8

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/dist/index.cjs.js CHANGED
@@ -256,19 +256,23 @@ function useSelectAtom(atom, key) {
256
256
 
257
257
  function useHydrateAtoms(values) {
258
258
  react.useEffect(function () {
259
- for (var _iterator = _createForOfIteratorHelperLoose(values), _step; !(_step = _iterator()).done;) {
260
- var _step$value = _step.value,
261
- atom = _step$value[0],
262
- value = _step$value[1];
263
- atom._behavior$.next(value);
264
- }
259
+ hydrateAtoms(values);
265
260
  }, []);
266
261
  }
262
+ function hydrateAtoms(values) {
263
+ for (var _iterator = _createForOfIteratorHelperLoose(values), _step; !(_step = _iterator()).done;) {
264
+ var _step$value = _step.value,
265
+ atom = _step$value[0],
266
+ value = _step$value[1];
267
+ atom._behavior$.next(value);
268
+ }
269
+ }
267
270
 
268
271
  function Signal() {}
269
272
 
270
273
  exports.Atom = Atom;
271
274
  exports.Signal = Signal;
275
+ exports.hydrateAtoms = hydrateAtoms;
272
276
  exports.useAtom = useAtom;
273
277
  exports.useHydrateAtoms = useHydrateAtoms;
274
278
  exports.useSelectAtom = useSelectAtom;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { Atom } from "./Atom";
2
2
  export { useAtom } from "./useAtom";
3
3
  export { useSelectAtom } from "./useSelectAtom";
4
- export { useHydrateAtoms } from "./useHydrateAtoms";
4
+ export { hydrateAtoms, useHydrateAtoms } from "./useHydrateAtoms";
5
5
  export { Signal } from "./Signal";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -254,19 +254,23 @@ var chemicalRx = (function (exports, rxjs, react) {
254
254
 
255
255
  function useHydrateAtoms(values) {
256
256
  react.useEffect(function () {
257
- for (var _iterator = _createForOfIteratorHelperLoose(values), _step; !(_step = _iterator()).done;) {
258
- var _step$value = _step.value,
259
- atom = _step$value[0],
260
- value = _step$value[1];
261
- atom._behavior$.next(value);
262
- }
257
+ hydrateAtoms(values);
263
258
  }, []);
264
259
  }
260
+ function hydrateAtoms(values) {
261
+ for (var _iterator = _createForOfIteratorHelperLoose(values), _step; !(_step = _iterator()).done;) {
262
+ var _step$value = _step.value,
263
+ atom = _step$value[0],
264
+ value = _step$value[1];
265
+ atom._behavior$.next(value);
266
+ }
267
+ }
265
268
 
266
269
  function Signal() {}
267
270
 
268
271
  exports.Atom = Atom;
269
272
  exports.Signal = Signal;
273
+ exports.hydrateAtoms = hydrateAtoms;
270
274
  exports.useAtom = useAtom;
271
275
  exports.useHydrateAtoms = useHydrateAtoms;
272
276
  exports.useSelectAtom = useSelectAtom;
package/dist/index.js CHANGED
@@ -178,12 +178,15 @@ function useSelectAtom(atom, key) {
178
178
 
179
179
  function useHydrateAtoms(values) {
180
180
  useEffect(() => {
181
- for (const [atom, value] of values) {
182
- atom._behavior$.next(value);
183
- }
181
+ hydrateAtoms(values);
184
182
  }, []);
185
183
  }
184
+ function hydrateAtoms(values) {
185
+ for (const [atom, value] of values) {
186
+ atom._behavior$.next(value);
187
+ }
188
+ }
186
189
 
187
190
  function Signal() {}
188
191
 
189
- export { Atom, Signal, useAtom, useHydrateAtoms, useSelectAtom };
192
+ export { Atom, Signal, hydrateAtoms, useAtom, useHydrateAtoms, useSelectAtom };
@@ -1,3 +1,4 @@
1
1
  import { BaseAtom } from "./Atom";
2
2
  export declare function useHydrateAtoms(values: readonly [BaseAtom<any>, any][]): void;
3
+ export declare function hydrateAtoms(values: readonly [BaseAtom<any>, any][]): void;
3
4
  //# sourceMappingURL=useHydrateAtoms.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useHydrateAtoms.d.ts","sourceRoot":"","sources":["../src/useHydrateAtoms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,QAMtE"}
1
+ {"version":3,"file":"useHydrateAtoms.d.ts","sourceRoot":"","sources":["../src/useHydrateAtoms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,QAItE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,QAInE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chem-rx",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "react state primitives powered by rx.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Atom } from "./Atom";
2
2
  export { useAtom } from "./useAtom";
3
3
  export { useSelectAtom } from "./useSelectAtom";
4
- export { useHydrateAtoms } from "./useHydrateAtoms";
4
+ export { hydrateAtoms, useHydrateAtoms } from "./useHydrateAtoms";
5
5
  export { Signal } from "./Signal";
@@ -3,8 +3,12 @@ import { BaseAtom } from "./Atom";
3
3
 
4
4
  export function useHydrateAtoms(values: readonly [BaseAtom<any>, any][]) {
5
5
  useEffect(() => {
6
- for (const [atom, value] of values) {
7
- atom._behavior$.next(value);
8
- }
6
+ hydrateAtoms(values);
9
7
  }, []);
10
8
  }
9
+
10
+ export function hydrateAtoms(values: readonly [BaseAtom<any>, any][]) {
11
+ for (const [atom, value] of values) {
12
+ atom._behavior$.next(value);
13
+ }
14
+ }