@reactables/core 1.2.0 → 1.3.0-alpha.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.
@@ -2,4 +2,6 @@ import { Reactable } from '../Models';
2
2
  export interface DestroyAction {
3
3
  destroy: () => void;
4
4
  }
5
- export declare const storeValue: <T, S>(reactable: Reactable<T, S>) => Reactable<T, S & DestroyAction>;
5
+ export declare const storeValue: <T, S>(reactable: Reactable<T, S & {
6
+ destroy?: () => void;
7
+ }>) => Reactable<T, S & DestroyAction>;
package/dist/index.js CHANGED
@@ -295,7 +295,12 @@ var storeValue = function (reactable) {
295
295
  var replaySubject$ = new rxjs.ReplaySubject(1);
296
296
  var state$ = reactable[0], actions = reactable[1], actions$ = reactable[2];
297
297
  var subscription = state$.subscribe(function (state) { return replaySubject$.next(state); });
298
- var destroy = function () { return subscription.unsubscribe(); };
298
+ var destroy = function () {
299
+ var _a;
300
+ // If destroy action already exists (i.e from a web worker), invoke it
301
+ (_a = actions.destroy) === null || _a === void 0 ? void 0 : _a.call(actions);
302
+ subscription.unsubscribe();
303
+ };
299
304
  return [replaySubject$, __assign(__assign({}, actions), { destroy: destroy }), actions$];
300
305
  };
301
306
 
package/package.json CHANGED
@@ -16,5 +16,5 @@
16
16
  "peerDependencies": {
17
17
  "rxjs": "^6.0.0 || ^7.0.0"
18
18
  },
19
- "version": "1.2.0"
19
+ "version": "1.3.0-alpha.0"
20
20
  }