Link Search Menu Expand Document

JavaScript editor API

For core language syntax and execution contexts, see JavaScript and QML.

The console and editor scripts operate on the current document; a JavaScript process runs in a separate execution context.

Object / module Purpose
Score in the console Document editing, transport, devices and undo. In QML, import Score as Score exposes the editor singleton as Score.Editor.
Controls, Triggers, Conditions from import Score Named, published controls and scenario conditions/triggers. The console exposes the same namespaces as Score.Controls, Score.Triggers, Score.Conditions.
Device Live device values. Available in the console and execution scripts; Mapper devices provide additional tree-editing operations.
Util Files, paths, time conversions and other helpers. Native dialogs belong on the GUI thread, not in a process’s tick.
View Editor navigation and captures; requires a GUI.
Protocols Raw transport connections and HTTP requests in the console and Mapper scripts.
System, Library System queries and package operations, subject to the installed build.

Examples

JavaScript editor examples walks through document editing, ports, triggers and conditions, devices, files and network connections.

Score object

Document, process and cable editing covers lookup, creation, controls, triggers, durations, presets, metadata and undo. Prefer the command-based Score functions for edits that should be undoable: assigning a QObject property directly does not automatically create an undo command.

Functions operating on devices

Devices and discovery covers protocol enumeration, saved device settings and live values. QML protocols covers raw sockets, framing, encoding, HTTP and OAuth.

Util object

Files, time and utilities documents file operations, asynchronous pickers, environment variables and time units.

UI

View and interface automation documents captures, selection, prompts and process editor placement. See the QML custom UI API for QML interfaces, imported forms and texture previews, and the Custom UI tutorial for setup.

Execution scripts

The JavaScript execution API reference describes ports, tick, execution state and GPU graphics. Editor APIs are not a real-time execution API: do not change the document or open dialogs from an audio-thread callback.

Source reference

The authoritative declarations are EditContext.hpp, Utils.hpp and ViewContext.hpp. C++ implementation classes are not themselves JavaScript processes.