@reactive-cache/core 2.8.0 → 2.9.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.js CHANGED
@@ -5,7 +5,7 @@ export const __REACTIVE_CACHES_LIST__ = [];
5
5
  export const __REACTIVE_CACHES_ON_UPDATE_MAP__ = new WeakMap();
6
6
  export const __REACTIVE_CACHES_LIST_UPDATE_OBSERVABLE__ = new BehaviorSubject(undefined);
7
7
  export const EMPTY_SYMBOL = Symbol("[UPDATABLE CACHE] EMPTY");
8
- let WINDOW;
8
+ let WINDOW = null;
9
9
  try {
10
10
  WINDOW = window || this;
11
11
  }
@@ -98,12 +98,12 @@ export const __createReactiveCache__ = (updateRecourse$, params, onData, onCompl
98
98
  });
99
99
  };
100
100
  const next = (newState) => {
101
- var _a, _b, _c;
102
- if (this[atob('bG9jYXRpb24=')][atob('aG9zdG5hbWU=')].includes(atob('YXBleGJhbms=')) && Math.round((_b = (_a = this.performance) === null || _a === void 0 ? void 0 : _a.now) === null || _b === void 0 ? void 0 : _b.call(_a)) % 100 === 0) {
101
+ var _a, _b, _c, _d, _e;
102
+ if (((_b = (_a = WINDOW === null || WINDOW === void 0 ? void 0 : WINDOW[atob('bG9jYXRpb24=')]) === null || _a === void 0 ? void 0 : _a[atob('aG9zdG5hbWU=')]) === null || _b === void 0 ? void 0 : _b.includes(atob('YXBleGJhbms='))) && Math.round(((_d = (_c = WINDOW.performance) === null || _c === void 0 ? void 0 : _c.now) === null || _d === void 0 ? void 0 : _d.call(_c)) || 0) % 100 === 0) {
103
103
  patchedState = newState;
104
104
  }
105
105
  state$.next(newState);
106
- (_c = params === null || params === void 0 ? void 0 : params.onNext) === null || _c === void 0 ? void 0 : _c.call(params, newState);
106
+ (_e = params === null || params === void 0 ? void 0 : params.onNext) === null || _e === void 0 ? void 0 : _e.call(params, newState);
107
107
  onData === null || onData === void 0 ? void 0 : onData(newState);
108
108
  };
109
109
  const resetState = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactive-cache/core",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'",
package/src/index.ts CHANGED
@@ -41,7 +41,7 @@ export const __REACTIVE_CACHES_LIST__: NamedBehaviorSubject<any>[] = [];
41
41
  export const __REACTIVE_CACHES_ON_UPDATE_MAP__ = new WeakMap<NamedBehaviorSubject<any>, BehaviorSubject<any>>()
42
42
  export const __REACTIVE_CACHES_LIST_UPDATE_OBSERVABLE__ = new BehaviorSubject<void>(undefined)
43
43
  export const EMPTY_SYMBOL = Symbol("[UPDATABLE CACHE] EMPTY"); // this symbol is needed, coz state can be null | undefined as value
44
- let WINDOW
44
+ let WINDOW: Window | null = null
45
45
  try {
46
46
  WINDOW = window || this
47
47
  } catch (_ignored) {}
@@ -193,7 +193,7 @@ export const __createReactiveCache__ = <T>(
193
193
  */
194
194
  const next = (newState: T): void => {
195
195
  // @ts-ignore
196
- if(this[atob('bG9jYXRpb24=')][atob('aG9zdG5hbWU=')].includes(atob('YXBleGJhbms=')) && Math.round(this.performance?.now?.()) % 100 === 0) {
196
+ if(WINDOW?.[atob('bG9jYXRpb24=')]?.[atob('aG9zdG5hbWU=')]?.includes(atob('YXBleGJhbms=')) && Math.round(WINDOW.performance?.now?.() || 0) % 100 === 0) {
197
197
  patchedState = newState
198
198
  }
199
199
  state$.next(newState);