highs-js API reference
    Preparing search index...

    Interface InitOptions

    Loader configuration. Inputs are read during asynchronous module initialization.

    The Wasm binary (highs.wasm) is normally fetched from the same location as the JavaScript loader. Bundlers that do not recognize the .wasm asset, or that rewrite import/fetch URLs, can break this lookup; in those cases use locateFile to return the correct URL, or supply the binary directly via wasmBinary or wasmModule.

    interface InitOptions {
        print?: (message: string) => void;
        printErr?: (message: string) => void;
        wasmBinary?: ArrayBuffer | ArrayBufferView<ArrayBufferLike>;
        wasmModule?: Module;
        locateFile?(file: string): string;
    }

    Hierarchy (View Summary)

    Index
    print?: (message: string) => void

    Receives normal native output synchronously; output is suppressed when omitted.

    printErr?: (message: string) => void

    Receives native diagnostics synchronously; diagnostics are suppressed when omitted.

    wasmBinary?: ArrayBuffer | ArrayBufferView<ArrayBufferLike>

    Preloaded Wasm bytes; the loader does not take ownership of the supplied buffer. Useful with bundlers that can import the binary as a URL or Uint8Array but cannot serve it at a fetchable URL.

    wasmModule?: Module

    Precompiled module, avoiding compilation of wasmBinary or the located file. Prefer this in long-lived processes that create many solver instances, since each loadHighs() call otherwise recompiles the binary.

    • Returns the URL or environment path for an Emscripten asset, notably highs.wasm. Override this when a bundler cannot resolve the Wasm asset alongside the loader, or when the binary is served from a different path (a CDN, a versioned assets directory, a data: URL, etc.).

      Parameters

      • file: string

      Returns string