AsyncCommand Class
Asynchronous command class.
Item Index
Methods
Methods
run
()
chainable
Execute the command function.
Attributes
args
Array
Array of arguments to be passed to the command function. A special callback function is automatically added as the first argument.
Default: []
Fires event argsChange
Fires when the value for the configuration attribute args
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
completed
Boolean
Boolean value indicating the completed status of the command.
Default: false
Fires event completedChange
Fires when the value for the configuration attribute completed
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
ctx
Execution context for the command function.
Fires event ctxChange
Fires when the value for the configuration attribute ctx
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
error
Error value passed to the failure event.
Fires event errorChange
Fires when the value for the configuration attribute error
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
failed
Boolean
Boolean value indicating the failed status of the command.
Default: false
Fires event failedChange
Fires when the value for the configuration attribute failed
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
fn
Function
The command function to execute. This function receives a special success callback function as the first parameter. The success callback function has a method parameter called fail. One of these callback functions must be called in order to complete the command.
Fires event fnChange
Fires when the value for the configuration attribute fn
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
started
Boolean
Boolean value indicating the started status of the command.
Default: false
Fires event startedChange
Fires when the value for the configuration attribute started
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
value
Value passed to the success event.
Fires event valueChange
Fires when the value for the configuration attribute value
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
Events
complete
Fired when the command function completes.
failure
protected
Fired when the command function fails.
Event Payload:
-
error
ObjectOptional error value.
start
protected
Fired when the command function starts.
success
protected
Fired when the command function succeeds.
Event Payload:
-
value
ObjectOptional return value from the command function.