Commands
Extends EndPoint
Provides access to Cantabile's UI commands
Access this object via the commands property.
Table of Contents
Methods
Retrieves a list of available commands
If Cantabile is running on your local machine you can view this list directly at http://localhost:35007/api/commands/availableCommands
Returns:
Promise | CommandInfo[][]:
A promise to return an array of CommandInfo
Example:
let C = new CantabileApi();
C.connect();
console.log(await C.commands.availableCommands());
close
()
Closes the end point and stops listening for events.
This method no longer needs to be explicitly called as end points are now
automatically closed when the last event listener is removed.
invoke
(
Promise
-
id
Invokes a command
Parameters:
-
id
StringThe id of the command to invoke
Returns:
Promise:
A promise that resolves once the target command has been invoked
Example:
Show the file open dialog
C.commands.invoke("file.open");
open
()
Opens this end point and starts listening for events.
This method no longer needs to be explicitly called as end points are now
automatically opened when the first event listener is attached.
Use this method to keep the end point open even when no event listeners are attached.
untilOpen
()
Promise
Returns a promise that will be resolved when this end point is opened
Returns:
Promise
Example:
let C = new CantabileApi();
C.application.open();
await C.application.untilOpen();