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