@sebastianwessel/quickjs
Version:
A typescript package to execute JavaScript and TypeScript code in a WebAssembly QuickJS sandbox
13 lines (12 loc) • 743 B
TypeScript
import type { LoadQuickJsOptions } from './types/LoadQuickJsOptions.js';
import type { SandboxFunction } from './types/SandboxFunction.js';
import type { SandboxOptions } from './types/SandboxOptions.js';
/**
* Loads the QuickJS module and returns a sandbox execution function.
* @param loadOptions - Options for loading the QuickJS module. Defaults to '@jitl/quickjs-ng-wasmfile-release-sync'.
* @returns An object containing the runSandboxed function and the loaded module.
*/
export declare const loadQuickJs: (loadOptions?: LoadQuickJsOptions) => Promise<{
runSandboxed: <T>(sandboxedFunction: SandboxFunction<T>, sandboxOptions?: SandboxOptions) => Promise<T>;
module: import("quickjs-emscripten-core").QuickJSWASMModule;
}>;