DomActionsMixin Class
Mixin containing logic making available to handle DOM-events related to component as inner & outer component's actions. Also contains methods to attach custom handlers for DOM-events with delayed clean up logic which will be executed before component will be destroyed.
Item Index
Methods
Methods
attachEventHandler
-
options
Attaches event handler for a given event-target. Also remembers attached handlers and related event-targets for clean up logic which will be executed before component will be destroyed, so use this method instead of explicit calls to jQuery.on method to avoid possible memory leaks.
Parameters:
-
options
ObjectMethod options.
-
eventTarget
ObjectDOM-element (jQuery-object) for which event-handler must be attached.
-
eventName
StringEvent name.
-
eventHandler
FunctionEvent handler.
-
closeModalDialog
()
Close current modal window if it exists.
createdModalDialog
-
modalDialog
Handles create modal window action. It saves created window to have opportunity to close it later.
Parameters:
-
modalDialog
JQueryCreated modal window.
detachAllEventHandlers
()
Detaches all event-handlers remembered in metadata when event-handlers were attached through 'attachEventHandler' method.
detachEventHandler
-
options
Detaches event-handler from a given event-target. Also cleans up metadata remembered when event-handler was attached through 'attachEventHandler' method.
Parameters:
-
options
ObjectMethod options.
-
eventTarget
ObjectDOM-element (jQuery-object) from which event-handler must be detached.
-
eventName
StringEvent name.
-
eventHandler
FunctionEvent handler.
-
send
-
actionName
-
args
Overridden 'send' method. Method logic still the same, but method now returns value returned by the action handler.
Parameters:
-
actionName
StringName of the action that must be triggered.
-
args
Arguments that must be passed to action.
Returns:
Returns value returned by action handler.
Properties
_availableDomEvents
Object
private
Dictionary containing names of DOM-events available for component's wrapping DOM-element and component's actions names related to them.
_eventsMetadata
Object[]
private
Array with objects containing selected event targets & handlers attached to them. Each object in array has following structure: { eventTarget: ..., attachedEventHandlers: { click: [function() {}, function() {}, ...], dblclick: [function() {}, function() {}, ...], ... } }.
Default: null
_openedModalDialog
JQuery
Current opened modal window.
Default: undefined