From 18a3fe291cdf5da1640bccf25a6fdd0f3cfb7aa0 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Tue, 9 Dec 2025 17:25:04 -0600 Subject: [PATCH] more refinements --- src/webpage/utils/utils.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/webpage/utils/utils.ts b/src/webpage/utils/utils.ts index 798fb31..17c565f 100644 --- a/src/webpage/utils/utils.ts +++ b/src/webpage/utils/utils.ts @@ -856,7 +856,13 @@ export class SW { port.port1.close(); }); this.postMessage({code: "ping"}); + const func = (update: boolean) => { + this.needsUpdate ||= update; + this.stopWatchForUpdates(func); + }; + this.watchForUpdates(func); } + static needsUpdate = false; static postMessage(message: messageTo) { this.port?.postMessage(message); } @@ -893,6 +899,7 @@ export class SW { } } static async checkUpdates(): Promise { + if (this.needsUpdate) return true; return new Promise((res) => { const func = (update: boolean) => { this.stopWatchForUpdates(func);