Skip to content

API reference / @jsprismarine/script-host / ScriptEngine / ScriptHostLibrary

Class: ScriptHostLibrary ​

Defined in: script-host/src/ScriptEngine.ts:145

The script host's native library, bound for this thread. Engines run on the thread that loaded it.

Methods ​

close() ​

close(): void

Defined in: script-host/src/ScriptEngine.ts:180

Unloads the library. Destroy its engines first.

Returns ​

void


createEngine() ​

createEngine(options?): ScriptEngine

Defined in: script-host/src/ScriptEngine.ts:175

Creates an engine: one QuickJS runtime and context, with the globals BDS lacks removed and Function from a string refused.

Parameters ​

options? ​

ScriptEngineOptions = {}

Its limits and module loader.

Returns ​

ScriptEngine

The engine.

Throws ​

When the engine cannot be created.


load() ​

static load(path?): ScriptHostLibrary

Defined in: script-host/src/ScriptEngine.ts:158

Loads the library and checks that it speaks this binding's interface.

Parameters ​

path? ​

string = ...

The library's file; locateLibrary finds it when absent.

Returns ​

ScriptHostLibrary

The bound library.

Throws ​

When there is no library, or it speaks another interface.