reactjrx 1.44.1 → 1.45.0

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 CHANGED
@@ -145,6 +145,23 @@ function trigger(mapper = rxjs.identity) {
145
145
  }
146
146
  ];
147
147
  }
148
+ const useBehaviorSubject = (state) => {
149
+ const subject = useConstant(() => new rxjs.BehaviorSubject(state));
150
+ const completed = react.useRef(false);
151
+ react.useEffect(() => {
152
+ if (completed.current) {
153
+ subject.current = new rxjs.BehaviorSubject(state);
154
+ completed.current = false;
155
+ }
156
+ return () => {
157
+ if (!completed.current) {
158
+ subject.current.complete();
159
+ completed.current = true;
160
+ }
161
+ };
162
+ }, []);
163
+ return subject;
164
+ };
148
165
  const SIGNAL_RESET = Symbol("SIGNAL_RESET");
149
166
  function signal(options) {
150
167
  const { default: defaultValue2 } = options ?? {};
@@ -410,23 +427,6 @@ function retryBackoff(config) {
410
427
  );
411
428
  });
412
429
  }
413
- const useBehaviorSubject = (state) => {
414
- const subject = useConstant(() => new rxjs.BehaviorSubject(state));
415
- const completed = react.useRef(false);
416
- react.useEffect(() => {
417
- if (completed.current) {
418
- subject.current = new rxjs.BehaviorSubject(state);
419
- completed.current = false;
420
- }
421
- return () => {
422
- if (!completed.current) {
423
- subject.current.complete();
424
- completed.current = true;
425
- }
426
- };
427
- }, []);
428
- return subject;
429
- };
430
430
  function shallowEqual(objA, objB) {
431
431
  if (objA === null || objA === void 0 || objB === null || objB === void 0) {
432
432
  return objA === objB;
@@ -1712,6 +1712,7 @@ exports.retryBackoff = retryBackoff;
1712
1712
  exports.signal = signal;
1713
1713
  exports.trigger = trigger;
1714
1714
  exports.useAsyncQuery = useAsyncQuery;
1715
+ exports.useBehaviorSubject = useBehaviorSubject;
1715
1716
  exports.useLiveRef = useLiveRef;
1716
1717
  exports.useObserve = useObserve;
1717
1718
  exports.useObserveCallback = useObserveCallback;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./lib/binding/useSubscribe";
3
3
  export * from "./lib/binding/useObserveCallback";
4
4
  export * from "./lib/binding/trigger";
5
5
  export * from "./lib/binding/useSubject";
6
+ export * from "./lib/binding/useBehaviorSubject";
6
7
  export * from "./lib/state/signal";
7
8
  export * from "./lib/state/useSignal";
8
9
  export * from "./lib/state/useSetSignal";
package/dist/index.js CHANGED
@@ -143,6 +143,23 @@ function trigger(mapper = identity) {
143
143
  }
144
144
  ];
145
145
  }
146
+ const useBehaviorSubject = (state) => {
147
+ const subject = useConstant(() => new BehaviorSubject(state));
148
+ const completed = useRef(false);
149
+ useEffect(() => {
150
+ if (completed.current) {
151
+ subject.current = new BehaviorSubject(state);
152
+ completed.current = false;
153
+ }
154
+ return () => {
155
+ if (!completed.current) {
156
+ subject.current.complete();
157
+ completed.current = true;
158
+ }
159
+ };
160
+ }, []);
161
+ return subject;
162
+ };
146
163
  const SIGNAL_RESET = Symbol("SIGNAL_RESET");
147
164
  function signal(options) {
148
165
  const { default: defaultValue2 } = options ?? {};
@@ -408,23 +425,6 @@ function retryBackoff(config) {
408
425
  );
409
426
  });
410
427
  }
411
- const useBehaviorSubject = (state) => {
412
- const subject = useConstant(() => new BehaviorSubject(state));
413
- const completed = useRef(false);
414
- useEffect(() => {
415
- if (completed.current) {
416
- subject.current = new BehaviorSubject(state);
417
- completed.current = false;
418
- }
419
- return () => {
420
- if (!completed.current) {
421
- subject.current.complete();
422
- completed.current = true;
423
- }
424
- };
425
- }, []);
426
- return subject;
427
- };
428
428
  function shallowEqual(objA, objB) {
429
429
  if (objA === null || objA === void 0 || objB === null || objB === void 0) {
430
430
  return objA === objB;
@@ -1711,6 +1711,7 @@ export {
1711
1711
  signal,
1712
1712
  trigger,
1713
1713
  useAsyncQuery,
1714
+ useBehaviorSubject,
1714
1715
  useLiveRef,
1715
1716
  useObserve,
1716
1717
  useObserveCallback,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "1.44.1",
4
+ "version": "1.45.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"