Constructor
new _ActionMixin()
- Source:
Example
{
$event: 'Original click event',
$src: 'The HTML node that initiated the event'
}
and then it mixes it all the `data-` attributes from the node into the params object.
Members
actionsFrom
Properties:
Name | Type | Description |
---|---|---|
Comma |
String | separated (no spaces) list of events to listen to |
- Source:
Methods
_getParametersForAction(name, evt, el) → {Object}
Extracts the `data-` attributes of an element and adds `$event` and `$source` being the two originals values.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the action/function being fired. |
evt |
Event | The original event |
el |
HTMLElement | The node that has the `data-action` attribute |
- Source:
Returns:
Object with the original event and source along with all the `data-` attributes in pascal case.
- Type
- Object
_initiateActionFromEvent(evt)
Takes an event and fires the closest valid `data-action` with the attached `data-` attributes
Parameters:
Name | Type | Description |
---|---|---|
evt |
Event |
- Source:
_isValidElementForAction(el) → {Boolean}
Verifies that the given HTML element is within our view.
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement |
- Source:
Returns:
- Type
- Boolean
hasAction(name, evt, el) → {Boolean}
Determines if the view contains a function with the given name
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of function being tested. |
evt |
||
el |
- Source:
Returns:
- Type
- Boolean
invokeAction(name, parameters, evt, el)
Calls the given function name in the context of the view passing
the parameters gathered and the event and element.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of function being invoked. |
parameters |
Object | Collection of `data-` attributes from the element. |
evt |
Event | The event that fired |
el |
HTMLElement | The HTML element that has the `data-action` |
- Source:
postCreate()
Extends the dijit Widget `postCreate` to connect to all events defined in `actionsFrom`.
- Source: