MCPcopy Create free account
hub / github.com/chhoumann/quickadd / userScriptDelegator

Method userScriptDelegator

src/engine/MacroChoiceEngine.ts:430–461  ·  view source on GitHub ↗
(userScript: unknown)

Source from the content-addressed store, hash-verified

428
429
430 protected async userScriptDelegator(userScript: unknown) {
431 switch (typeof userScript) {
432 case "function":
433 if (!isUserScriptFunction(userScript)) {
434 break;
435 }
436 if (this.userScriptCommand) {
437 await this.runScriptWithSettings(
438 userScript,
439 this.userScriptCommand
440 );
441 } else {
442 await this.onExportIsFunction(userScript);
443 }
444 break;
445 case "object":
446 if (isUserScriptObjectExport(userScript)) {
447 await this.onExportIsObject(userScript);
448 }
449 break;
450 case "bigint":
451 case "boolean":
452 case "number":
453 case "string":
454 this.output = userScript.toString();
455 break;
456 default:
457 log.logError(
458 `user script in macro for '${this.choice.name}' is invalid`
459 );
460 }
461 }
462
463 private async onExportIsFunction(
464 userScript: (

Callers 2

executeUserScriptMethod · 0.95
onExportIsObjectMethod · 0.95

Calls 6

runScriptWithSettingsMethod · 0.95
onExportIsFunctionMethod · 0.95
onExportIsObjectMethod · 0.95
isUserScriptFunctionFunction · 0.85
isUserScriptObjectExportFunction · 0.85
logErrorMethod · 0.65

Tested by

no test coverage detected