getParentEventTarget
.
To set the parent event target, call setParentEventTarget
or
override getParentEventTarget
in a subclass. Subclasses that
don't support changing the parent event target should override the setter
to throw an error.
Example usage:
var et = new goog.events.EventTarget; function f(e) { alert("Type: " + e.type + "\nTarget: " + e.target); } et.addEventListener("foo", f); ... et.dispatchEvent({type: "foo"}); // will call f // or et.dispatchEvent("foo"); ... et.removeEventListener("foo", f); // You can also use the EventHandler interface: var eh = { handleEvent: function(e) { ... } }; et.addEventListener("bar", eh);
Objectgoog.Disposable
goog.events.EventTarget
![]()
Adds an event listener to the event target. The same handler can only be
added once per the type. Even if you add the same handler multiple times
using the same type then it will only be called once when the event is
dispatched.
Supported for legacy but use goog.events.listen(src, type, handler) instead.
Arguments:
|
code » | |||||
Dispatches an event (or event like object) and calls all listeners
listening for events of this type. The type of the event is decided by the
type property on the event object.
If any of the listeners returns false OR calls preventDefault then this
function will return false. If one of the capture listeners calls
stopPropagation, then the bubble listeners won't fire.
Arguments:
Returns:
If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.
|
code » | |||||
![]()
Unattach listeners from this object. Classes that extend EventTarget may
need to override this method in order to remove references to DOM Elements
and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass }; |
code » | |||||
Returns the parent of this event target to use for bubbling.
Returns:
The parent EventTarget or null if there is no parent.
|
code » | |||||
![]()
Removes an event listener from the event target. The handler must be the
same object as the one added. If the handler has not been added then
nothing is done.
Arguments:
|
code » | |||||
![]()
Sets the parent of this event target to use for bubbling.
Arguments:
|
code » |
![]()
No description.
|
code » | |
![]()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend {@code goog.Disposable} should
override this method. For example:
mypackage.MyClass = function() { goog.Disposable.call(this); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { mypackage.MyClass.superClass_.disposeInternal.call(this); // Dispose logic specific to MyClass. ... }; |
code » | |
No description.
Returns:
Whether the object has been disposed of.
|
code » | |
No description.
Returns:
Whether the object has been disposed of.
|
code » |