executeCommandEx Method

Description

Executes an editor command with onSuccess and onError handlers.

Syntax

.executeCommandEx(/*String*/ commandName, /*Function*/ onSuccess, /*Function*/ onError, [parameters])

Parameters

commandName: String

The name of the command to be executed. This must be a valid command name. More information on editor commands is available here.

onSuccess: Function

A function with no parameters. This function will be called when the command has been executed successfully.

onError: Function

A function that accepts one parameter, an Error object. This function will be called if the command fails. The passed Error object indicates the nature of the failure.

[parameters]

Commands may have parameters. More information on the parameters for each editor command is available here.

Example

// Enable the grid.
editor.executeCommandEx('enableGrid', onSuccess, onError, true);

...

// Start a line drawing operation.
editor.executeCommandEx('draw_line', onSuccess, onError);