Skip to main content

Module javascript

Module javascript 

Source
Expand description

In-app scratch scripts. Source is saved only on request and never on a model.

Structs§

JavaScriptEditor

Constants§

WINDOW_ID
The window’s egui id — one name for the panel, the tests and the host.

Statics§

HIT_KEYS
The hit keys this window publishes under __brepJavascriptHit (see automation::hit_keys); panel:clip is the key every scrolling pane publishes for its visible region, so click_widget can wheel a row into view.

Traits§

ScriptHost
Where Run sends a program when the app has a script runner: the app’s own server’s code mode (crate::mcp::EditorHost), the same realm, limits and generated brep.<group>.<tool> functions an agent’s run_script gets. Without one (the web build, a bare test harness) Run uses the plugin runner’s editor action.

Functions§

program
An editor script as a program for the ScriptHost. A module (a line starting import or export) runs as written. Anything else is a classic editor body: it runs with cad.document (the history snapshot with addFeature(type, params, persistentData), updateFeature(id, params) (a merge, as feature_set_params merges) and deleteFeature(id)), cad.selection, cad.brep (every app tool) and ui.notify; the document commands apply in order after it returns, and a returned value prints as Result:. The body may await.