mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add slash command for dice rolls. Create class for worker wrappers
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user