TomTom Maps for JavaScript
    Preparing search index...

    Type Alias CodeExecutionConfig

    Tunes the sandbox execution of analyseData, processData, createTracker and clusterIncidents code. The environment decides where the code runs. In the browser, it is a sandboxed, opaque-origin iframe + Web Worker (no DOM/storage access, no network via CSP, terminable on timeout). In Node / SSR, where that boundary has no equivalent, it is the main thread. The options below only apply in the browser.

    type CodeExecutionConfig = {
        allowMainThreadFallback?: boolean;
        loadWorkerLibrarySource?: () => string | Promise<string>;
        timeoutMs?: number;
    }
    Index
    allowMainThreadFallback?: boolean

    Whether code runs on the page's main thread, NOT isolated, when the iframe can't start. Defaults to false: the code-running tools then return an error to the model, and a call 30 seconds or more later tries the iframe again. When true, the failure is final and later runs stay on the main thread. MapAgentInstance.getCodeExecutionMode reports which happened.

    loadWorkerLibrarySource?: () => string | Promise<string>

    Optional override of the worker's library source. By default, the SDK loads its own inlined turf/h3 UMD (a separate lazy chunk), so this is rarely needed. Supply it only to pin a specific build or add libraries. Return UMD/IIFE JavaScript that defines self.turf and self.h3 (string or Promise of one).

    timeoutMs?: number

    Wall-clock budget per isolated (browser) run, in ms. Defaults to 10000.