core.EventDispatcher Class
The main class that implements broadcaster pattern. Ideally subclassed by objects that will perform broadcasting functions.
Constructor
core.EventDispatcher
-
opts
Parameters:
-
opts
ObjectAn object containing configurations required by the Core derived class.
-
el
HTMLElementThe 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:
-
method
StringThe string equivalent of the defined method to clear.
construct
-
options
Core method initialization. This is called automatically on core sub classes.
Parameters:
-
options
ObjectThe object passed on the constructor of a core based class.
containsScope
-
list
-
scope
Checks the array of listeners for existing scopes.
Parameters:
-
list
ArrayReference to the array of subscribed listeners
-
scope
ObjectReference 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:
-
options
ObjectThe object passed on the constructor of a core based class.
dispose
-
removeNode
Core method for destroying/cleaning up objects.
Parameters:
-
removeNode
BooleanIf 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:
-
selector
StringThe 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:
-
selector
StringThe 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:
-
method
StringThe 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:
-
eventName
StringThe event name unsubscribing from.
-
method
FunctionThe method handler to trigger when the event specified is dispatched.
-
scope
core.CoreReference to the scope of the event handler
on
-
eventName
-
method
-
scope
Subscribe function. Called when adding a subscriber to the broadcasting object.
Parameters:
-
eventName
StringThe event name being subscribed to
-
method
FunctionThe method handler to trigger when the event specified is dispatched.
-
scope
core.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:
-
eventName
StringThe event name being subscribed to
-
method
FunctionThe method handler to trigger when the event specified is dispatched.
-
scope
core.CoreReference to the scope of the event handler
register
-
eventName
-
scope
-
method
-
once
Private method handler for event registration.
Parameters:
-
eventName
StringThe event name being added on the listener list.
-
scope
ObjectReference to the scope of the event handler
-
method
FunctionThe method used by the scope to handle the event being broadcasted
-
once
BooleanSpecify 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:
-
scope
core.CoreReference to the scope subscriber being removed.
trigger
-
eventName
-
variables
Broadcast functions. Triggers a broadcast on the EventDispatcher/derived object.
Parameters:
-
eventName
StringThe event name to trigger/broadcast.
-
variables
ObjectAn object to send upon broadcast
unregister
-
eventName
-
scope
-
method
-
once
Private method handler for unregistering events
Parameters:
-
eventName
StringThe event name being added on the listener list.
-
scope
ObjectReference to the scope of the event handler
-
method
FunctionThe method used by the scope to handle the event being broadcasted
-
once
BooleanSpecify 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