DETLEF JavaScript SDK

DETLEF JavaScript SDK

Use sdk/js/detlef.mjs with generated Wasm bindings. Keep packages.mjs beside it. Build the bindings using the Wasm build instructions; all files must come from the same release.

Language concepts

See the language manual for evaluation, values and types, and scoping. These concepts explain how callbacks and controls evaluate arguments and access variables.

Run a script

The Node example initializes the runtime, evaluates 42, reads the result, and disposes the allocated handles. After building the bindings, run it from the repository root:

CODE
node examples/js/node.mjs

In a browser, import the web bindings and await their default initialization function before calling createAPI. The browser example shows that setup.

Find an operation

TaskReference
Execute scripts, install stdlib, register callbacks, load packagesRuntime
Read, access, retain, or dispose a resultValue
Construct arrays and records inside a functionFunctionAccess
Access variables or evaluate source during setup or a controlAccess
Implement a lazy controlControlCallback and ControlArguments

Package authors use the C SDK; JavaScript hosts load compiled Wasm packages through Runtime#loadPackage. The courier package demonstrates an application-specific Function returning a record. Its Node package host loads the archive and prints the result of courier_quote(1200, true).