initializeWasmModule function

Future<void> initializeWasmModule({
  1. required String root,
})

The code is used only internally and is not a public API. The comment exists mainly to satisfy the linter.

Implementation

Future<void> initializeWasmModule({required String root}) async {
  _ensureCrossOriginIsolated();

  final script = web.HTMLScriptElement()..src = '$root.js';
  web.document.head!.append(script);

  await script.onLoad.first;

  jsEval('window.wasm_bindgen = wasm_bindgen');

  await _jsWasmBindgen('${root}_bg.wasm').toDart;
}