ExperimentalExperimental
Register a command with a declaration as the player takes it.
The id, the declaration, the first state and the handler.
The command, owned by this scope.
Experimental: the wire protocol is not semver; this member changes
with versions. declaration is commands.register's: title, path,
order, group, radio, bindings, focus, repeat, button,
category and home (as in CommandOptions). The SDK adds the id,
the revision and the state and checks nothing in it: bindings must
already be in the player's canonical form (Ctrl+H).
The command starts enabled; once the plugin has nothing to export, it greys it out with an explicit state. No update pass evaluates it.
const exporter = plugin.wire.commands.register({ id: "export", declaration });
await exporter.update({ enabled: false, reason: "Nothing to export" });
Bare command registrations (
plugin.wire.commands): the player's declaration as given, a state of values and a handler. Experimental: the wire protocol is not semver; this member changes with versions.Remarks
Commands.add checks the options, builds the declaration and keeps function fields current through the update passes.
registersends a declaration of the plugin's own making and leaves its state to explicit WireCommand.update calls. The player checks the declaration and refuses it as foradd; during activation the registration is awaited and a refusal is handled likeadd's (logged and skipped by the player's runner, failingstartPluginin tests).Example: Register a menu item from a declaration
Playback ▸ Cycle Speed, bound to C, from a declaration written as the player takes it. Picking it runs
run, as for a command ofadd.Since
1.7.0