core.EventDispatcher Class
The main class that implements broadcaster pattern. Ideally subclassed by objects that will perform broadcasting functions.
Constructor
core.EventDispatcher
-
opts
Parameters:
-
optsObjectAn object containing configurations required by the Core derived class.
-
elHTMLElementThe node element included in the class composition. TODO: Refactor and simplify listening function - something like this.on("EVENT", method); but still retain garbage collection
-
Item Index
Methods
Properties
Methods
clearProxyHandler
-
method
Core method for clearing proxied function methods.
Parameters:
-
methodStringThe string equivalent of the defined method to clear.
construct
-
options
Core method initialization. This is called automatically on core sub classes.
Parameters:
-
optionsObjectThe object passed on the constructor of a core based class.
containsScope
-
list -
scope
Checks the array of listeners for existing scopes.
Parameters:
-
listArrayReference to the array of subscribed listeners
-
scopeObjectReference to the scope being queried for existence
Returns:
Returns boolean indicating the existence of the scope passed on the parameters
delayedConstruct
-
options
Core method initialization. This is called automatically on core sub classes. Adds delay when being called automatically, this allows time to setup all the other classes and manage the sequence of instantiations.
Parameters:
-
optionsObjectThe object passed on the constructor of a core based class.
dispose
-
removeNode
Core method for destroying/cleaning up objects.
Parameters:
-
removeNodeBooleanIf true and there is a node attached in the class (el property) that element is going to be removed upon disposal.
find
-
selector
Core method for searching sub node elements.
Parameters:
-
selectorStringThe selector used for searching sub nodes.
Returns:
An array of HTMLElements, please note that this is not jQuery selected nodes.
findAll
-
selector
Core method for searching sub node elements within the document context.
Parameters:
-
selectorStringThe selector used for searching sub nodes within the document.
Returns:
An array of HTMLElements, please note that this is not jQuery selected nodes.
getProxyHandler
-
method
Returns a scope bound function and stores it on the proxyHandlers property.
Parameters:
-
methodStringThe string equivalent of the defined method name of the class.
Returns:
The scope bound function defined on the parameter.
off
-
eventName -
method -
scope
Unsubscribe function. Called when removing a subscriber from the broadcasting object.
Parameters:
-
eventNameStringThe event name unsubscribing from.
-
methodFunctionThe method handler to trigger when the event specified is dispatched.
-
scopecore.CoreReference to the scope of the event handler
on
-
eventName -
method -
scope
Subscribe function. Called when adding a subscriber to the broadcasting object.
Parameters:
-
eventNameStringThe event name being subscribed to
-
methodFunctionThe method handler to trigger when the event specified is dispatched.
-
scopecore.CoreReference to the scope of the event handler
once
-
eventName -
method -
scope
Subscribe once function. Called when adding a subscriber to the broadcasting object.
Parameters:
-
eventNameStringThe event name being subscribed to
-
methodFunctionThe method handler to trigger when the event specified is dispatched.
-
scopecore.CoreReference to the scope of the event handler
register
-
eventName -
scope -
method -
once
Private method handler for event registration.
Parameters:
-
eventNameStringThe event name being added on the listener list.
-
scopeObjectReference to the scope of the event handler
-
methodFunctionThe method used by the scope to handle the event being broadcasted
-
onceBooleanSpecify whether the event should only be handled once by the scope and its event handler
removeAll
()
Removes all items from the listener list.
removeScope
-
scope
Unsubscribe function - scope context. Unsubscribes a specific scope from ALL events
Parameters:
-
scopecore.CoreReference to the scope subscriber being removed.
trigger
-
eventName -
variables
Broadcast functions. Triggers a broadcast on the EventDispatcher/derived object.
Parameters:
-
eventNameStringThe event name to trigger/broadcast.
-
variablesObjectAn object to send upon broadcast
unregister
-
eventName -
scope -
method -
once
Private method handler for unregistering events
Parameters:
-
eventNameStringThe event name being added on the listener list.
-
scopeObjectReference to the scope of the event handler
-
methodFunctionThe method used by the scope to handle the event being broadcasted
-
onceBooleanSpecify whether the event should only be handled once by the scope and its event handler
Properties
node
HTMLElement
The selected HTML element node reference.
proxyHandlers
Object
Property for storing proxied function/methods
