@kodiak-finance/orderly-hooks 2.8.5 → 2.8.6
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 +17 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -3196,6 +3196,20 @@ var CalculatorService = class {
|
|
|
3196
3196
|
this.referenceCount = /* @__PURE__ */ new Map();
|
|
3197
3197
|
this.isPaused = false;
|
|
3198
3198
|
this.calculators = new Map(calculators);
|
|
3199
|
+
this.bindVisibilityListener();
|
|
3200
|
+
}
|
|
3201
|
+
bindVisibilityListener() {
|
|
3202
|
+
if (typeof document !== "undefined") {
|
|
3203
|
+
this.visibilityListener = () => {
|
|
3204
|
+
if (document.visibilityState === "visible") {
|
|
3205
|
+
this.onTabBecomeVisible();
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
document.addEventListener("visibilitychange", this.visibilityListener);
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
onTabBecomeVisible() {
|
|
3212
|
+
this.calcQueue = [];
|
|
3199
3213
|
}
|
|
3200
3214
|
register(scope, calculator) {
|
|
3201
3215
|
const ref_count_name = `${scope}_${calculator.name}`;
|
|
@@ -3272,6 +3286,9 @@ var CalculatorService = class {
|
|
|
3272
3286
|
stop() {
|
|
3273
3287
|
this.calcQueue = [];
|
|
3274
3288
|
this.ctx?.clearCache();
|
|
3289
|
+
if (this.visibilityListener && typeof document !== "undefined") {
|
|
3290
|
+
document.removeEventListener("visibilitychange", this.visibilityListener);
|
|
3291
|
+
}
|
|
3275
3292
|
}
|
|
3276
3293
|
get windowIsVisible() {
|
|
3277
3294
|
if (typeof document === "undefined") {
|