Optional
captionThe caption for the command.
This should be a simple one line description of the command. It is used by some visual representations to show quick info about the command.
This can be a string literal, or a function which returns the caption based on the provided command arguments.
The default value is an empty string.
Optional
classThe general class name for the command.
This class name will be added to the primary node for the visual representation of the command.
Multiple class names can be separated with white space.
This can be a string literal, or a function which returns the class name based on the provided command arguments.
The default value is an empty string.
Optional
datasetThe dataset for the command.
The dataset values will be added to the primary node for the visual representation of the command.
This can be a dataset object, or a function which returns the dataset object based on the provided command arguments.
The default value is an empty dataset.
Optional
describedJSON Schemas describing the command.
For now, the command arguments are the only one that can be described.
The function to invoke when the command is executed.
This should return the result of the command (if applicable) or a promise which yields the result. The result is resolved as a promise and that promise is returned to the code which executed the command.
This may be invoked even when isEnabled
returns false
.
If called via a keybinding the passed args will include a _luminoEvent
that specify the event type and keys pressed for customization.
Optional
iconThe icon renderer for the command.
This can be an IRenderer object, or a function which returns the renderer based on the provided command arguments.
The default value is undefined
.
Optional
iconThe icon class for the command.
This class name will be added to the icon node for the visual representation of the command.
Multiple class names can be separated with white space.
This can be a string literal, or a function which returns the icon based on the provided command arguments.
The default value is an empty string.
Optional
iconThe icon label for the command.
This label will be added as text to the icon node for the visual representation of the command.
This can be a string literal, or a function which returns the label based on the provided command arguments.
The default value is an empty string.
Optional
isA function which indicates whether the command is enabled.
Visual representations may use this value to display a disabled command as grayed-out or in some other non-interactive fashion.
The default value is () => true
.
If called via a keybinding the passed args will include a _luminoEvent
that specify the event type and keys pressed for customization
Optional
isA function which indicates whether the command is toggleable.
Visual representations may use this value to display a toggled command in a different form, such as a check box for a menu item or a depressed state for a toggle button. This attribute also allows for accessible interfaces to notify the user that the command corresponds to some state.
The default value is true
if an isToggled
function is given, false
otherwise.
Optional
isA function which indicates whether the command is toggled.
Visual representations may use this value to display a toggled command in a different form, such as a check mark icon for a menu item or a depressed state for a toggle button.
The default value is () => false
.
Optional
isA function which indicates whether the command is visible.
Visual representations may use this value to hide or otherwise not display a non-visible command.
The default value is () => true
.
Optional
labelThe label for the command.
This can be a string literal, or a function which returns the label based on the provided command arguments.
The label is often used as the primary text for the command.
The default value is an empty string.
Optional
mnemonicThe index of the mnemonic character in the command's label.
This can be an index literal, or a function which returns the mnemonic index based on the provided command arguments.
The mnemonic character is often used by menus to provide easy single-key keyboard access for triggering a menu item. It is typically rendered as an underlined character in the label.
The default value is -1
.
Optional
usageThe usage text for the command.
This should be a full description of the command, which includes information about the structure of the arguments and the type of the return value. It is used by some visual representations when displaying complete help info about the command.
This can be a string literal, or a function which returns the usage text based on the provided command arguments.
The default value is an empty string.
An options object for creating a command.
Notes
A command is an abstract representation of code to be executed along with metadata for describing how the command should be displayed in a visual representation.
A command is a collection of functions, not methods. The command registry will always invoke the command functions with a
thisArg
which isundefined
.