Engines - Scripting engine
The engines module provides access to the current script engine, allows starting new engines, stopping running engines, and communicating between engines.
Table of contents
Interfaces
- EngineEventTarget
- ExecutionConfig
- ReadOnlyExecutionConfig
- ScriptEngine
- ScriptExecution
- SelfScriptEngine
- StopAllOptions
Functions
Functions
broadcast
broadcast(event: string, ...args: any[]): void
Broadcast an event to all running engines.
Parameters
event: Event name....args: Event arguments. Values should be JSON-serializable.
Returns
void
execScriptFile
execScriptFile(file: string, config?: ExecutionConfig ): ScriptExecution
The context and environment of the executed script and the environment on the new engine will be unrelated to the current execution and cannot share the variables. It can be communicated between scripts via events or broadcast.
Parameters
file: Script file path (absolute path or project-relative path).config: Execution configuration.
Returns
Use the returned ScriptExecution to await engine(), listen for start / success / exception, or inspect sourceFile.
getRunningEngines
getRunningEngines(): ScriptEngine []
Returns every currently running script engine instance.
Returns
ScriptEngine []
myEngine
myEngine: SelfScriptEngine
Handle for this script’s engine (extra helpers beyond plain ScriptEngine).
Returns
stopAll
stopAll(options?: StopAllOptions ): void
Stop all engines.
Parameters
options: Stop options.
Returns
void
