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:
-
optionsObjectMethod options.
-
eventTargetObjectDOM-element (jQuery-object) for which event-handler must be attached.
-
eventNameStringEvent name.
-
eventHandlerFunctionEvent 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:
-
modalDialogJQueryCreated 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:
-
optionsObjectMethod options.
-
eventTargetObjectDOM-element (jQuery-object) from which event-handler must be detached.
-
eventNameStringEvent name.
-
eventHandlerFunctionEvent handler.
-
send
-
actionName -
args
Overridden 'send' method. Method logic still the same, but method now returns value returned by the action handler.
Parameters:
-
actionNameStringName of the action that must be triggered.
-
argsArguments 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
Flexberry Documentation