IFClite TypeScript API
    Preparing search index...

    Function createSandbox

    @ifc-lite/sandbox — QuickJS-in-WASM sandboxed script execution

    Runs user scripts in a secure, isolated environment with only the bim.* API exposed. No DOM, no global fetch. Outbound HTTP is available only through bim.network.fetch, gated by the network permission (off by default) plus an exact-host grant list re-checked on every call — see network-request.ts and bridge-network.ts.

    import { createSandbox } from '@ifc-lite/sandbox';
    import { createBimContext } from '@ifc-lite/sdk';

    const bim = createBimContext({ backend: myBackend });
    const sandbox = await createSandbox(bim, {
    permissions: { mutate: true },
    limits: { timeoutMs: 10_000 },
    });

    const result = await sandbox.eval(`
    const walls = bim.query.byType('IfcWall');
    console.log('Found', walls.length, 'walls');
    walls.length;
    `);

    console.log(result.value); // number of walls
    console.log(result.logs); // captured console.log output

    sandbox.dispose();
    • Create and initialize a sandbox.

      Usage: const sandbox = await createSandbox(bim, { permissions: { mutate: true } }) const result = await sandbox.eval('bim.query.byType("IfcWall")') sandbox.dispose()

      Parameters

      Returns Promise<Sandbox>