configureLiteRtWebLoader function

void configureLiteRtWebLoader({
  1. String? moduleUrl,
  2. String? wasmUrl,
  3. bool? autoLoad,
})

Configure the LiteRT.js web auto-loader.

Call it once before the first LiteRtInterpreter.fromBytes(...) when you need to self-host the LiteRT.js module/WASM files or disable auto-loading.

  • moduleUrl: ESM URL for the @litertjs/core bundle.
  • wasmUrl: URL passed to LiteRt.loadLiteRt(...). Either a directory ending in / (lets LiteRT.js auto-detect SIMD/threaded) or a specific .js file.
  • autoLoad: when false, disables auto-injection. The host page is then responsible for loading the runtime and assigning it to window.LiteRt.

Implementation

void configureLiteRtWebLoader({
  String? moduleUrl,
  String? wasmUrl,
  bool? autoLoad,
}) {
  if (moduleUrl != null) _liteRtModuleUrl = moduleUrl;
  if (wasmUrl != null) _liteRtWasmUrl = wasmUrl;
  if (autoLoad != null) _autoLoaderEnabled = autoLoad;
}