[]previous and next page

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_BACKEND names an implementation that cannot be loaded (native or wasm), or is not one of auto, native, wasm and javascript.

Examples#

ts
import { getBackend } from "@shadow-js/compiler";

const { name } = getBackend();
console.log(["native", "wasm", "javascript"].includes(name)); // true