mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-05-24 23:55:29 +00:00
more refinements
This commit is contained in:
@@ -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<boolean> {
|
||||
if (this.needsUpdate) return true;
|
||||
return new Promise((res) => {
|
||||
const func = (update: boolean) => {
|
||||
this.stopWatchForUpdates(func);
|
||||
|
||||
Reference in New Issue
Block a user