loadAvoidRouter
loadAvoidRouter(filePath?: string): Promise<void>;
Loads the libavoid WebAssembly module on the main thread. initAvoidRouter() calls this automatically when the module is not loaded yet, so calling it directly is only needed to preload the module ahead of time.
filePath is an optional path to the libavoid.wasm binary, used when it is not served from its default location (which is resolved relative to the executing script).
Safe to call multiple times - concurrent and later calls resolve once the first load completes. A failed load is not cached, so a subsequent call retries.
import { loadAvoidRouter } from '@joint/router-avoid';
await loadAvoidRouter('/assets/libavoid.wasm');
When initAvoidRouter() is called with worker: true, the module is loaded inside the Worker thread instead - loading it on the main thread as well would only waste memory and startup time.
See serving the WebAssembly binary in the learn section for how to get the file into your bundle.