API Reference alternera_plugin_javascript v#0.9.0

Copy Markdown View Source

Modules

The JavaScript step: a script written as the body of a function, run on the request or the response in a fresh WebAssembly instance per call. What it returns goes where its To rows say, as Script's returned value does.

Compiles the JavaScript module once when the package starts (PluginWasmFramework.Modules.load/2): compiling the interpreter takes a few hundred milliseconds, which would otherwise fall on the first step that runs. A module that fails to compile is logged there and fails each step that runs it; the application starts regardless, so the rest of the proxy does.

The JavaScript step's editor: the framework's PluginWasmFramework.StepEditor over Javascript.language/0, and the Help it shows. The colouring is registered by Javascript.EditorMode.

The JavaScript step's colouring in the proxy's code editor: a colocated hook whose module code registers the language "javascript" with the editor when app.js loads (window.AlterneraEditorModes, read by the proxy's assets/js/lua_editor/registered_modes.js). The hook itself does nothing and no element uses it.