Follow along with the runnable example. This guide walks through the App control example in
corti-examples — bootstrap your build from it or use it as reference.EditorAdapter. Your app registers its actionable UI as named controls; command dispatch resolves a spoken target to a control and runs it — gated by whether that control is available right now.
This guide assumes you’ve read Commands — declaring
commands in the config and handling the command event work exactly the same here.Register your app’s controls
Each actionable piece of UI registers itself as a control with a spokenlabel, a kind, a run effect, and optionally isAvailable() (for contextual commands) and getState() (for app awareness).
JavaScript
details control.
Declare the commands
Declare the command set as usual. Useenum variables for finite target sets (tabs, panels) and verb-led full phrases for buttons — they recognize more reliably than a generic click {button} slot and are more natural to speak.
JavaScript
Route commands to controls
Handle thecommand event and route each id to registry.run(target, arg). The registry resolves the target, checks isAvailable(), and runs the control — so contextual gating (e.g. confirm only while a dialog is open) lives with the control, not the command handler.
JavaScript
Application awareness
Because every control exposesisAvailable() and getState(), the registry can produce a live snapshot of what’s on screen and actionable — useful for a debug overlay, or to make commands contextual.
JavaScript
Web or native
The registry is DOM-agnostic — it only knowslabel, run, and the availability/state hooks. The same register → resolve → run contract can be implemented by a desktop or OS host over an IPC bridge, so your command-and-control logic runs unchanged against a web UI or a native application.
Next steps
Commands
The declare → event → dispatch loop these app-control commands build on.
Dictation Box
Move text between a scratch box and your form fields by voice.
Example code
The complete, runnable App control example in
corti-examples.Please contact us for help or questions.