Constructor
new Action(name, actionPerformed)
Action constructor
Parameters:
| Name | Type | Description | 
|---|---|---|
name | string | The name of this Action  | 
actionPerformed | function | The callback to be triggered by this Action  | 
Members
description :string
An optional description
Type:
- string
 
enabled :boolean
Action status. true means enabled, false disabled
Type:
- boolean
 
name :string
The action's name
Type:
- string
 
Methods
actionPerformed(_thisAction, _event)
Here is where subclasses must define the callback to be triggered when
this Action object is called
Parameters:
| Name | Type | Description | 
|---|---|---|
_thisAction | module:AWT. | Pointer to this Action object  | 
_event | object | The original action event that has originated this action  | 
addStatusListener(listener)
Adds a status listener
Parameters:
| Name | Type | Description | 
|---|---|---|
listener | function | The callback method to be called when the status of this  | 
processEvent(event)
This is the method to be passed to DOM event triggers
Parameters:
| Name | Type | Description | 
|---|---|---|
event | object | The event object passed by the DOM event trigger  | 
Example
<p>const myFunc = () => { alert('Hello!') }<br>
const myAction = new Action('hello', myFunc)<br>
$( "#foo" ).bind( "click", myAction.processEvent)</p>removeStatusListener(listener)
Removes a previously registered status listener
Parameters:
| Name | Type | Description | 
|---|---|---|
listener | function | The listener to be removed  | 
setEnabled(enabled)
Enables or disables this action
Parameters:
| Name | Type | Description | 
|---|---|---|
enabled | boolean |