Home

Class goog.events.EventHandler

Super class for objects that want to easily manage a number of event listeners. It allows a short cut to listen and also provides a quick way to remove all events listeners belonging to this object.

extends goog.Disposable
Instance Method Summary
disposeInternal()

Disposes of this EventHandler and removes all listeners that it registered.

getListenerCount() ⇒ number
handleEvent(?goog.events.Event e)

Default event handler

listen((EventTarget|goog.events.EventTarget|null) src, (Array|null|string) type, ?Object= opt_fn, boolean= opt_capture, ?Object= opt_handler) ⇒ ?goog.events.EventHandler

Listen to an event on a DOM node or EventTarget. If the function is omitted then the EventHandler's handleEvent method will be used.

listenOnce((EventTarget|goog.events.EventTarget|null) src, (Array|null|string) type, ?Object= opt_fn, boolean= opt_capture, ?Object= opt_handler) ⇒ ?goog.events.EventHandler

Listen to an event on a DOM node or EventTarget. If the function is omitted then the EventHandler's handleEvent method will be used. After the event has fired the event listener is removed from the target. If an array of event types is provided, each event type will be listened to once.

listenWithWrapper((EventTarget|goog.events.EventTarget|null) src, ?goog.events.EventWrapper wrapper, ?Object listener, boolean= opt_capt, ?Object= opt_handler) ⇒ ?goog.events.EventHandler

Adds an event listener with a specific event wrapper on a DOM Node or an object that has implemented {@link goog.events.EventTarget}. A listener can only be added once to an object.

removeAll()

Unlistens to all events.

unlisten((EventTarget|goog.events.EventTarget|null) src, (Array|null|string) type, ?Object= opt_fn, boolean= opt_capture, ?Object= opt_handler) ⇒ ?goog.events.EventHandler

Unlistens on an event.

unlistenWithWrapper((EventTarget|goog.events.EventTarget|null) src, ?goog.events.EventWrapper wrapper, ?Object listener, boolean= opt_capt, ?Object= opt_handler) ⇒ ?goog.events.EventHandler

Removes an event listener which was added with listenWithWrapper().