Merge pull request #1010 from bbassie/feature/plugin-browser

Plugin management through web interface
This commit is contained in:
Bastiaan authored and GitHub committed 2026-10-27 21:32:51 +00:00
1 parent e36a76acc5
commit ffe82f81d8
48 files changed
+4275 -536

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
/** Runs one task at a time, refusing tasks started while another is running */
export class ExclusiveRunner<State> {
current?: State;
onChange: (state?: State) => void;
constructor(onChange: (state?: State) => void) {
this.onChange = onChange;
}
/** Run the task unless another is running, returns false if it was refused */
async run(state: State, task: () => Promise<void>) {
if (this.current !== undefined) {
return false;
}
this.current = state;
this.onChange(state);
try {
await task();
} finally {
this.current = undefined;
this.onChange(undefined);
}
return true;
}
}