@webkrafters/eagleeye 1.0.0-beta.2 → 1.0.0-beta.4

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/README.md CHANGED
@@ -86,7 +86,7 @@ const useStream = context.stream;
86
86
  // for more on selectorMap - https://eagleeye.js.org/concepts/selector-map/
87
87
  const channel1 = useStream(SelectorMap?);
88
88
  const channel2 = useStream(SelectorMap?);
89
- // check whether a channel still defunct or still active
89
+ // check whether a channel is still active or defunt
90
90
  if( channel1.closed ) { ... };
91
91
  // access the current data value monitored by this channel
92
92
  console.log( 'data', channel1.data );
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Changes as BaseChanges, Immutable as AutoImmutable, Value } from '@webkrafters/auto-immutable';
2
2
  import { FULL_STATE_SELECTOR } from './constants';
3
3
  import { createEagleEye, Channel } from './main';
4
- export type { BaseType, ClearCommand, KeyType, MoveCommand, PushCommand, ReplaceCommand, SetCommand, SpliceCommand, TagCommand, TagType, UpdateStats, UpdatePayload, UpdatePayloadArray } from '@webkrafters/auto-immutable';
4
+ export type { BaseType, ClearCommand, Immutable as AutoImmutable, KeyType, MoveCommand, PushCommand, ReplaceCommand, SetCommand, SpliceCommand, TagCommand, TagType, UpdateStats, UpdatePayload, UpdatePayloadArray } from '@webkrafters/auto-immutable';
5
5
  export type State = Value;
6
6
  export type ShutdownMonitor = (reason: ShutdownReason) => void;
7
7
  export type Listener = <T extends State>(changes: Changes<T>, changedPathsTokens: Readonly<Array<Array<string>>>, netChanges: Readonly<T>, mayHaveChangesAt: (pathTokens: Array<string>) => boolean) => void;
@@ -566,22 +566,11 @@ var EagleEyeContext = function () {
566
566
  this.prehooks = prehooks;
567
567
  this.storage = storage;
568
568
  this._store = this._createInternalStore();
569
- var ctx = this;
570
569
  this._storeRef = {
571
- getState: function getState() {
572
- var propertyPaths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
573
- return ctx._store.getState(propertyPaths);
574
- },
575
- resetState: function resetState() {
576
- var propertyPaths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
577
- return ctx._store.resetState(propertyPaths);
578
- },
579
- setState: function setState(changes) {
580
- return ctx._store.setState(changes);
581
- },
582
- subscribe: function subscribe(eventType, listener) {
583
- return ctx._store.subscribe(eventType, listener);
584
- }
570
+ getState: this._store.getState,
571
+ resetState: this._store.resetState,
572
+ setState: this._store.setState,
573
+ subscribe: this._store.subscribe
585
574
  };
586
575
  }
587
576
  return _createClass(EagleEyeContext, [{
@@ -759,18 +748,18 @@ var EagleEyeContext = function () {
759
748
  get closed() {
760
749
  return !connection;
761
750
  },
762
- getState: function getState(propertyPaths) {
751
+ getState: function getState() {
752
+ var propertyPaths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
763
753
  return ctx.getState(connection, propertyPaths);
764
754
  },
765
- resetState: function resetState(propertyPaths) {
755
+ resetState: function resetState() {
756
+ var propertyPaths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
766
757
  return ctx.resetState(connection, propertyPaths);
767
758
  },
768
759
  setState: function setState(changes) {
769
760
  return ctx.setState(connection, changes);
770
761
  },
771
- subscribe: function subscribe(eventType, listener) {
772
- return ctx.subscribe(eventType, listener);
773
- }
762
+ subscribe: ctx.subscribe.bind(ctx)
774
763
  };
775
764
  }
776
765
  }, {
package/package.json CHANGED
@@ -97,7 +97,7 @@
97
97
  "test:watch": "eslint --fix && jest --updateSnapshot --watchAll"
98
98
  },
99
99
  "types": "dist/index.d.ts",
100
- "version": "1.0.0-beta.2",
100
+ "version": "1.0.0-beta.4",
101
101
  "dependencies": {
102
102
  "@webkrafters/auto-immutable": "^2.0.5"
103
103
  }