circu.js
    Preparing search index...

    Isolated JavaScript context within the same runtime. Each Sandbox has its own global scope — variables and modules in one sandbox cannot pollute another or the main context.

    const engine = import.meta.use('engine');
    const sb = new engine.Sandbox();
    sb.call('var x = 42');
    sb.call('x'); // 42
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get global(): Record<string, any> & typeof globalThis

      The sandbox's global object

      Returns Record<string, any> & typeof globalThis

    Methods

    • Evaluate code in the sandbox context (global scope)

      Type Parameters

      • T = any

      Parameters

      • code: string

        JavaScript code to execute

      • Optionalname: string

        Optional filename for stack traces

      Returns T

      Result of evaluation

    • Compile and evaluate an ES module in the sandbox context

      Type Parameters

      • T = Record<string, any>

      Parameters

      • code: string

        Module source code

      • name: string

        Module name (for stack traces and import resolution)

      Returns T

      Module namespace object