Skip to main content

program

Function program 

Source
pub fn program(source: &str) -> String
Expand description

An editor script as a program for the ScriptHost: both are plain script bodies with top-level await and return, and sdk (every app command as await sdk.<namespace>.<action>(args)) is the runner’s global. The editor adds its own names around the body: 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.sdk (the same sdk) and ui.notify. The document commands apply in order after the body returns, and a returned value prints as Result:. One leading import … from "@brep/cad" line is dropped, as the runner drops it.