goog.events.Listenable
with full W3C
EventTarget-like support (capture/bubble mechanism, stopping event
propagation, preventing default actions).
You may subclass this class to turn your class into a Listenable.
Unlike goog.events.EventTarget
, this class does not implement
goog.disposable.IDisposable
. Instances of this class that have had
It is not necessary to call goog.dispose
or #removeAllListeners
in order for an instance of this class
to be garbage collected.
Unless propagation is stopped, an event dispatched by an
EventTarget will bubble to the parent returned by
getParentEventTarget
. To set the parent, call
setParentEventTarget
. Subclasses that don't support
changing the parent can override the setter to throw an error.
Example usage:
var source = new goog.labs.events.NonDisposableEventTarget(); function handleEvent(e) { alert('Type: ' + e.type + '; Target: ' + e.target); } source.listen('foo', handleEvent); source.dispatchEvent('foo'); // will call handleEventTODO(user|johnlenz): Consider a more modern, less viral (not based on inheritance) replacement of goog.Disposable, which will allow goog.events.EventTarget to not be disposable.
goog.labs.events.NonDisposableEventTarget |
![]()
Asserts that the event target instance is initialized properly.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » | ||
![]()
Sets the parent of this event target to use for capture/bubble
mechanism.
Arguments:
|
code » | ||
![]()
No description.
|
code » | ||
![]()
No description.
|
code » |
![]()
Dispatches the given event on the ancestorsTree.
TODO(user): Look for a way to reuse this logic in
goog.events, if possible.
Arguments:
Returns: boolean
If anyone called preventDefault on the event object (or
if any of the listeners returns false) this will also return false.
|
code » |
![]()
An artificial cap on the number of ancestors you can have. This is mainly
for loop detection.
|
Code » |