events.ListenerMap Extends
Creates a new listener map.

Inheritance

Constructor

goog.events.ListenerMap(src)

Parameters

src : EventTarget | goog.events.Listenable
The src object.

Instance Methods

Public Protected Private
add(typelistenercallOnceopt_useCaptureopt_listenerScope) goog.events.ListenableKey
Adds an event listener. A listener can only be added once to an object and if it is added again the key for the listener is returned. Note that a one-off listener will not change an existing listener, if any. On the other hand a normal listener will change existing one-off listener to become a normal listener.
Arguments:
type : string | !goog.events.EventId
The listener event type.
listener : !Function
This listener callback method.
callOnce : boolean
Whether the listener is a one-off listener.
opt_useCapture : boolean=
The capture mode of the listener.
opt_listenerScope : Object=
Object in whose scope to call the listener.
Returns: goog.events.ListenableKey  Unique key for the listener.
code »
getListener(typelistenercaptureopt_listenerScope) goog.events.ListenableKey
Gets the goog.events.ListenableKey for the event or null if no such listener is in use.
Arguments:
type : string | !goog.events.EventId
The type of the listener to retrieve.
listener : !Function
The listener function to get.
capture : boolean
Whether the listener is a capturing listener.
opt_listenerScope : Object=
Object in whose scope to call the listener.
Returns: goog.events.ListenableKey  the found listener or null if not found.
code »
getListenerCount() number
No description.
Returns: number  Total number of registered listeners.
code »
getListeners(typecapture) !Array.<goog.events.ListenableKey>
Gets all listeners that match the given type and capture mode. The returned array is a copy (but the listener objects are not).
Arguments:
type : string | !goog.events.EventId
The type of the listeners to retrieve.
capture : boolean
The capture mode of the listeners to retrieve.
Returns: !Array.<goog.events.ListenableKey>  An array of matching listeners.
code »
getTypeCount() number
No description.
Returns: number  The count of event types in this map that actually have registered listeners.
code »
hasListener(opt_typeopt_capture) boolean
Whether there is a matching listener. If either the type or capture parameters are unspecified, the function will match on the remaining criteria.
Arguments:
opt_type : string | !goog.events.EventId=
The type of the listener.
opt_capture : boolean=
The capture mode of the listener.
Returns: boolean  Whether there is an active listener matching the requested type and/or capture phase.
code »
remove(typelisteneropt_useCaptureopt_listenerScope) boolean
Removes a matching listener.
Arguments:
type : string | !goog.events.EventId
The listener event type.
listener : !Function
This listener callback method.
opt_useCapture : boolean=
The capture mode of the listener.
opt_listenerScope : Object=
Object in whose scope to call the listener.
Returns: boolean  Whether any listener was removed.
code »
removeAll(opt_type) number
Removes all listeners from this map. If opt_type is provided, only listeners that match the given type are removed.
Arguments:
opt_type : string | !goog.events.EventId=
Type of event to remove.
Returns: number  Number of listeners removed.
code »
removeByKey(listener) boolean
Removes the given listener object.
Arguments:
listener : goog.events.ListenableKey
The listener to remove.
Returns: boolean  Whether the listener is removed.
code »

Instance Properties

listeners :
Maps of event type to an array of listeners.
Code »
No description.
Code »
typeCount_ :
The count of types in this map that have registered listeners.
Code »

Static Methods

goog.events.ListenerMap.findListenerIndex_(listenerArraylisteneropt_useCaptureopt_listenerScope) number
Finds the index of a matching goog.events.Listener in the given listenerArray.
Arguments:
listenerArray : !Array.<!goog.events.Listener>
Array of listener.
listener : !Function
The listener function.
opt_useCapture : boolean=
The capture flag for the listener.
opt_listenerScope : Object=
The listener scope.
Returns: number  The index of the matching listener within the listenerArray.
code »

Package events

Package Reference