Add slash command for dice rolls. Create class for worker wrappers

This commit is contained in:
SillyLossy
2023-05-31 13:57:08 +03:00
parent b2016fa7f3
commit ef90c31643
7 changed files with 836 additions and 885 deletions

View File

@ -8,12 +8,38 @@ export {
defaultRequestArgs,
modules,
extension_settings,
ModuleWorkerWrapper,
};
let extensionNames = [];
let manifests = [];
const defaultUrl = "http://localhost:5100";
// Disables parallel updates
class ModuleWorkerWrapper {
constructor(callback) {
this.isBusy = false;
this.callback = callback;
}
// Called by the extension
async update() {
// Don't touch me I'm busy...
if (this.isBusy) {
return;
}
// I'm free. Let's update!
try {
this.isBusy = true;
await this.callback();
}
finally {
this.isBusy = false;
}
}
}
const extension_settings = {
apiUrl: defaultUrl,
autoConnect: false,