goog.events
Functions
dispatchEvent( src, e ) → boolean
boolean
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.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
expose( e ) → string
string
fireListener( listener, eventObject ) → *
*
Fires a listener with a set of arguments
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
fireListeners( obj, type, capture, eventObject ) → boolean
boolean
Fires an object's listeners of a particular type and phase
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
getListener<EVENTOBJ>( src, type, listener, opt_capt, opt_handler ) → (goog.events.ListenableKey|null)
(goog.events.ListenableKey|null)
Gets the goog.events.Listener for the event or null if no such listener is in use.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
getListeners( obj, type, capture ) → Array<goog.events.Listener>
Array<goog.events.Listener>
Gets the listeners for a given object, type and capture phase.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
getProxy() → Function
Function
Helper function for returning a proxy function.
Parameters | None. | ||
---|---|---|---|
Returns |
|
getTotalListenerCount() → number
number
Gets the total number of listeners currently in the system.
warning Deprecated | This returns estimated count, now that Closure no longer stores a central listener registry. We still return an estimation to keep existing listener-related tests passing. In the near future, this function will be removed. |
---|
Parameters | None. | ||
---|---|---|---|
Returns |
|
getUniqueId( identifier ) → string
string
hasListener( obj, opt_type, opt_capture ) → boolean
boolean
Returns whether an event target has any active listeners matching the specified signature. If either the type or capture parameters are unspecified, the function will match on the remaining criteria.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
listen<T, EVENTOBJ>( src, type, listener, opt_options, opt_handler ) → (number|goog.events.ListenableKey|null)
(number|goog.events.ListenableKey|null)
Adds an event listener for a specific event on a native event
target (such as a DOM element) or an object that has implemented
goog.events.Listenable
. 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 if the existing listener is a one-off listener
(registered via listenOnce), it will no longer be a one-off
listener after a call to listen().
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
listenOnce<T, EVENTOBJ>( src, type, listener, opt_options, opt_handler ) → (number|goog.events.ListenableKey|null)
(number|goog.events.ListenableKey|null)
Adds an event listener for a specific event on a native event
target (such as a DOM element) or an object that has implemented
goog.events.Listenable
. After the event has fired the event
listener is removed from the target.
If an existing listener already exists, listenOnce will do nothing. In particular, if the listener was previously registered via listen(), listenOnce() will not turn the listener into a one-off listener. Similarly, if there is already an existing one-off listener, listenOnce does not modify the listeners (it is still a once listener).
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
listenWithWrapper<T>( src, wrapper, listener, opt_capt, opt_handler ) → void
void
Adds an event listener with a specific event wrapper on a DOM Node or an
object that has implemented goog.events.Listenable
. A listener can
only be added once to an object.
Parameters |
|
---|
protectBrowserEventEntryPoint( errorHandler ) → void
void
Installs exception protection for the browser event entry point using the given error handler.
Parameters |
|
---|
removeAll( obj, opt_type ) → number
number
Removes all listeners from an object. You can also optionally remove listeners of a particular type.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
unlisten<EVENTOBJ>( src, type, listener, opt_options, opt_handler ) → (boolean|null)
(boolean|null)
Removes an event listener which was added with listen().
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
unlistenByKey( key ) → boolean
boolean
Removes an event listener which was added with listen() by the key returned by listen().
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
unlistenWithWrapper( src, wrapper, listener, opt_capt, opt_handler ) → void
void
Removes an event listener which was added with listenWithWrapper().
Parameters |
|
---|
wrapListener( listener ) → Function
Function
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
Properties
A typedef for event like objects that are dispatchable via the goog.events.dispatchEvent function. strings are treated as the type for a goog.events.Event. Objects are treated as an extension of a new goog.events.Event with the type property of the object being used as the type of the Event.
Key → (number|goog.events.ListenableKey|null)
(number|goog.events.ListenableKey|null)
No information.
ListenableType → (EventTarget|goog.events.Listenable|null)
(EventTarget|goog.events.Listenable|null)
No information.
Mapping of mouse event names to underlying browser event names.
Compiler Constants
goog.events.CAPTURE_SIMULATION_MODE → number
number
The capture simulation mode for IE8-. By default, this is ON.