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:
node examples/js/node.mjsIn a browser, import the web bindings and await their default initialization function before calling createAPI. The browser example shows that setup.
Find an operation
| Task | Reference |
|---|---|
| Execute scripts, install stdlib, register callbacks, load packages | Runtime |
| Read, access, retain, or dispose a result | Value |
| Construct arrays and records inside a function | FunctionAccess |
| Access variables or evaluate source during setup or a control | Access |
| Implement a lazy control | ControlCallback 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).