PlugOS refactor and other tweaks (#631)

* Prep for in-process plug loading (e.g. for CF workers, Deno Deploy)
* Prototype of fixed in-process loading plugs
* Fix: buttons not to scroll with content
* Better positioning of modal especially on mobile
* Move query caching outside query
* Fix annoying mouse behavior when filter box appears
* Page navigator search tweaks
This commit is contained in:
Zef Hemel
2024-01-15 16:43:12 +01:00
committed by GitHub
parent a9eb252658
commit a2dbf7b3db
65 changed files with 591 additions and 617 deletions
+7 -7
View File
@@ -37,24 +37,24 @@ export class PromiseQueue {
resolve: (value: any) => void;
reject: (error: any) => void;
}[] = [];
private running = false;
private processing = false;
runInQueue(fn: () => Promise<any>): Promise<any> {
return new Promise((resolve, reject) => {
this.queue.push({ fn, resolve, reject });
if (!this.running) {
this.run();
if (!this.processing) {
this.process();
}
});
}
private async run(): Promise<void> {
private async process(): Promise<void> {
if (this.queue.length === 0) {
this.running = false;
this.processing = false;
return;
}
this.running = true;
this.processing = true;
const { fn, resolve, reject } = this.queue.shift()!;
try {
@@ -64,7 +64,7 @@ export class PromiseQueue {
reject(error);
}
this.run(); // Continue processing the next promise in the queue
this.process(); // Continue processing the next promise in the queue
}
}