getBackend
Tells which implementation compile uses on this machine, loading it if it was not loaded yet.
Tells which implementation compile uses on this machine, loading it if it was not loaded yet. The choice is made once per process and does not change.
Import#
ts
import { getBackend } from "@shadow-js/compiler";
Signature#
ts
function getBackend(): BackendInfo
Returns#
The implementation, where it came from, and why a faster one was not used.
Throws#
- Error When
SHADOW_COMPILER_BACKENDnames an implementation that cannot be loaded (nativeorwasm), or is not one ofauto,native,wasmandjavascript.
Examples#
ts
import { getBackend } from "@shadow-js/compiler";
const { name } = getBackend();
console.log(["native", "wasm", "javascript"].includes(name)); // true