The 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.
The 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.
The 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.
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
.
The 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.
The 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.
A 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
.
A 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
.
A 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
.
The 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.
The 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
.
The 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.
Generated using TypeDoc
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
.