nondisposableeventtarget.js
No description.

File Location

/goog/labs/events/nondisposableeventtarget.js

Classes

goog.labs.events.NonDisposableEventTarget
An implementation of 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 handleEvent
TODO(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.

Public Protected Private

Global Functions

goog.labs.events.NonDisposableEventTarget.dispatchEventInternal_(targeteopt_ancestorsTree) boolean
Dispatches the given event on the ancestorsTree. TODO(user): Look for a way to reuse this logic in goog.events, if possible.
Arguments:
target : !Object
The target to dispatch on.
e : goog.events.Event | Object | string
The event object.
opt_ancestorsTree : Array.<goog.events.Listenable>>
The ancestors tree of the target, in reverse order from the closest ancestor to the root event target. May be null if the target has no ancestor.
Returns: boolean  If anyone called preventDefault on the event object (or if any of the listeners returns false) this will also return false.
code »

Directory events

File Reference