Module editor
Expand description
The RAVET editor protocol: JSON text messages between a plug-in and its web editor, addressed by parameter key.
Every format adapter uses this protocol, so products write no editor codec.
Messages are JSON objects with a type field. Values are physical values in
the parameter’s range unless sent as normalized (0 to 1).
Editor to plug-in (parse), at most MAXIMUM_INCOMING_BYTES:
type | Fields | Meaning |
|---|---|---|
ready | protocol | Page loaded; reply with info and snapshot |
begin | key | Start a continuous gesture |
set | key, value or normalized | A value inside an open gesture |
end | key | End a gesture |
commit | key, value or normalized | One complete edit (begin, set, end) |
product | data | Product-defined message |
Plug-in to editor (built by the functions below):
type | Fields |
|---|---|
info | protocol, product (name, vendor, version), parameters (metadata by key, in declaration order) |
snapshot | sequence, parameters (all values by key), optional telemetry and product |
changes | sequence, parameters (changed values by key) |
product | data |
sequence increases with every snapshot or change message, so an editor can
ignore stale data. All functions allocate and run on the main thread.
Structs§
- Gestures
- Tracks open gestures for one editor, so adapters can reject unbalanced messages and end every gesture when the editor closes.
Enums§
- Editor
Message - A validated editor message. Parameters are identified by declaration index.
- Gesture
Error - A gesture message that does not match the open gestures.
- Protocol
Error - Reasons an editor message is rejected. Nothing is applied.
Constants§
- CLIENT_
SCRIPT - The editor client script injected into every editor page.
- MAXIMUM_
INCOMING_ BYTES - Largest accepted editor message, matching the web view message limit.
- PROTOCOL_
VERSION - Protocol version carried by
readyandinfo.
Functions§
- changes
- The
changesmessage with changed values as (declaration index, value). - info
- The
infomessage: product and parameter metadata for building the editor. - page
- The product’s page with the editor client injected at the start of
<head>, or at the start of the document when there is no<head>. - parse
- Parse and validate one editor message.
- product_
message - A product-defined message to the editor.
- snapshot
- The
snapshotmessage with every parameter value in declaration order. Nonfinite values are omitted; they cannot occur in validated state.