selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
97 lines (94 loc) • 45.3 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.events</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog.events</h1><a class="source" href="source/lib/goog/events/eventid.js.src.html#l15">code »</a></header><section></section><section><h2>Interfaces</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="interface_goog_events_Listenable.html">goog.events.Listenable</a><dd>A listenable interface.<dt><a href="interface_goog_events_ListenableKey.html">goog.events.ListenableKey</a><dd>An interface that describes a single registered listener.</dl></table></div></section><section><h2>Classes</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="class_goog_events_BrowserEvent.html">goog.events.BrowserEvent</a><dd>Accepts a browser event object and creates a patched, cross browser event
object.<dt><a href="class_goog_events_Event.html">goog.events.Event</a><dd>A base class for event objects, so that they can support preventDefault and
stopPropagation.<dt><a href="class_goog_events_EventId.html">goog.events.EventId</a><dd>A templated class that is used when registering for events.<dt><a href="class_goog_events_EventTarget.html">goog.events.EventTarget</a><dd>An implementation of <code >goog.events.Listenable</code> with full W3C
EventTarget-like support (capture/bubble mechanism, stopping event
propagation, preventing default actions).<dt><a href="class_goog_events_Listener.html">goog.events.Listener</a><dd>Simple class that stores information about a listener<dt><a href="class_goog_events_ListenerMap.html">goog.events.ListenerMap</a><dd>Creates a new listener map.</dl></table></div></section><section><h2>Enumerations</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="enum_goog_events_BrowserFeature.html">goog.events.BrowserFeature</a><dd>Enum of browser capabilities.<dt><a href="enum_goog_events_CaptureSimulationMode.html">goog.events.CaptureSimulationMode</a><dd>No Description.<dt><a href="enum_goog_events_EventType.html">goog.events.EventType</a><dd>Constants for event names.<dt><a href="enum_goog_events_KeyCodes.html">goog.events.KeyCodes</a><dd>Key codes for common characters.</dl></table></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="typedefs"><h2>Type Definitions</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/events/event.js.src.html#l41">code »</a><a class="member" name="goog.events.EventLike">goog.events.EventLike</a> : <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="class_goog_events_Event.html">goog.events.Event</a>|<a href="class_goog_events_EventId.html">goog.events.EventId</a>)</code></div><div>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.</div></summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l72">code »</a><a class="member" name="goog.events.Key">goog.events.Key</a> : <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="interface_goog_events_ListenableKey.html">goog.events.ListenableKey</a>)</code></div><div>No description.</div></summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l78">code »</a><a class="member" name="goog.events.ListenableType">goog.events.ListenableType</a> : <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code></div><div>No description.</div></summary></details></div></div></section><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l773">code »</a><span class="member"><a name="goog.events.dispatchEvent">goog.events.dispatchEvent</a> <span class="args">( src, e )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type"><a href="interface_goog_events_Listenable.html">goog.events.Listenable</a></code><dd>The event target.<dt>e: <code class="type"><a href="namespace_goog_events.html#goog.events.EventLike">goog.events.EventLike</a></code><dd>Event object.</dl><tr><th>Returns<tr><td><dl>If anyone called preventDefault on the event object (or
if any of the handlers returns false) this will also return false.
If there are no handlers, or if all handlers return true, this returns
true.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l643">code »</a><span class="member"><a name="goog.events.expose">goog.events.expose</a> <span class="args">( e )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Provides a nice string showing the normalized event objects public members</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>e: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Event Object.</dl><tr><th>Returns<tr><td><dl>String of the public members of the normalized event object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l733">code »</a><span class="member"><a name="goog.events.fireListener">goog.events.fireListener</a> <span class="args">( listener, eventObject )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Fires a listener with a set of arguments</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>listener: <code class="type"><a href="class_goog_events_Listener.html">goog.events.Listener</a></code><dd>The listener object to call.<dt>eventObject: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The event object to pass to the listener.</dl><tr><th>Returns<tr><td><dl>Result of listener.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l681">code »</a><span class="member"><a name="goog.events.fireListeners">goog.events.fireListeners</a> <span class="args">( obj, type, capture, eventObject )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Fires an object's listeners of a particular type and phase</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Object whose listeners to call.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>)</code><dd>Event type.<dt>capture: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>Which event phase.<dt>eventObject: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Event object to be passed to listener.</dl><tr><th>Returns<tr><td><dl>True if all listeners returned true else false.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l699">code »</a><span class="member"><a name="goog.events.fireListeners_">goog.events.fireListeners_</a> <span class="args">( obj, type, capture, eventObject )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Fires an object's listeners of a particular type and phase.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Object whose listeners to call.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>)</code><dd>Event type.<dt>capture: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>Which event phase.<dt>eventObject: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Event object to be passed to listener.</dl><tr><th>Returns<tr><td><dl>True if all listeners returned true else false.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l590">code »</a><code class="type"><EVENTOBJ></code> <span class="member"><a name="goog.events.getListener">goog.events.getListener</a> <span class="args">( src, type, listener, opt_capt, opt_handler )</span> ⇒ <code class="type"><a href="interface_goog_events_ListenableKey.html">goog.events.ListenableKey</a></code></span></div><p>Gets the goog.events.Listener for the event or null if no such listener is
in use.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>The target from
which to get listeners.<dt>type: <code class="type">(?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>.<EVENTOBJ>)</code><dd>The type of the event.<dt>listener: <code class="type">(function(EVENTOBJ): ?|{handleEvent: function(?): ?}|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>)</code><dd>The
listener function to get.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>In DOM-compliant browsers, this determines
whether the listener is fired during the
capture or bubble phase of the event.<dt>opt_handler: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Element in whose scope to call the listener.</dl><tr><th>Returns<tr><td><dl>the found listener or null if not found.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l941">code »</a><span class="member"><a name="goog.events.getListenerMap_">goog.events.getListenerMap_</a> <span class="args">( src )</span> ⇒ <code class="type"><a href="class_goog_events_ListenerMap.html">goog.events.ListenerMap</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">EventTarget</code><dd>The source object.</dl><tr><th>Returns<tr><td><dl>A listener map for the given
source object, or null if none exists.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l557">code »</a><span class="member"><a name="goog.events.getListeners">goog.events.getListeners</a> <span class="args">( obj, type, capture )</span> ⇒ <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="class_goog_events_Listener.html">goog.events.Listener</a>></code></span></div><p>Gets the listeners for a given object, type and capture phase.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Object to get listeners for.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>)</code><dd>Event type.<dt>capture: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>Capture phase?.</dl><tr><th>Returns<tr><td><dl>Array of listener objects.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l664">code »</a><span class="member"><a name="goog.events.getOnString_">goog.events.getOnString_</a> <span class="args">( type )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a string with on prepended to the specified type. This is used for IE
which expects "on" to be prepended. This function caches the string in order
to avoid extra allocations in steady state.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>type: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Event type.</dl><tr><th>Returns<tr><td><dl>The type string with 'on' prepended.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l270">code »</a><span class="member"><a name="goog.events.getProxy">goog.events.getProxy</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code></span></div><p>Helper function for returning a proxy function.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A new or reused function object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l752">code »</a><span class="member deprecation-notice"><a name="goog.events.getTotalListenerCount">goog.events.getTotalListenerCount</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">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.</span></div><p>Gets the total number of listeners currently in the system.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Number of listeners.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l930">code »</a><span class="member"><a name="goog.events.getUniqueId">goog.events.getUniqueId</a> <span class="args">( identifier )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Creates a unique event id.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>identifier: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The identifier.</dl><tr><th>Returns<tr><td><dl>A unique identifier.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/eventtype.js.src.html#l35">code »</a><span class="member"><a name="goog.events.getVendorPrefixedName_">goog.events.getVendorPrefixedName_</a> <span class="args">( eventName )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a prefixed event name for the current browser.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>eventName: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The name of the event.</dl><tr><th>Returns<tr><td><dl>The prefixed event name.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l806">code »</a><span class="member"><a name="goog.events.handleBrowserEvent_">goog.events.handleBrowserEvent_</a> <span class="args">( listener, opt_evt )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Handles an event and dispatches it to the correct listeners. This
function is a proxy for the real listener the user specified.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>listener: <code class="type"><a href="class_goog_events_Listener.html">goog.events.Listener</a></code><dd>The listener object.<dt>opt_evt: <code class="type">Event=</code><dd>Optional event object that gets passed in via the
native event handlers.</dl><tr><th>Returns<tr><td><dl>Result of the event handler.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l627">code »</a><span class="member"><a name="goog.events.hasListener">goog.events.hasListener</a> <span class="args">( obj, opt_type, opt_capture )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>Target to get
listeners for.<dt>opt_type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>)=</code><dd>Event type.<dt>opt_capture: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to check for capture or bubble-phase
listeners.</dl><tr><th>Returns<tr><td><dl>Whether an event target has one or more listeners matching
the requested type and/or capture phase.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l911">code »</a><span class="member"><a name="goog.events.isMarkedIeEvent_">goog.events.isMarkedIeEvent_</a> <span class="args">( e )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>This is used to check if an IE event has already been handled by the Closure
system so we do not do the Closure pass twice for a bubbling event.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>e: <code class="type">Event</code><dd>The IE browser event.</dl><tr><th>Returns<tr><td><dl>True if the event object has been marked.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l168">code »</a><code class="type"><T, EVENTOBJ></code> <span class="member"><a name="goog.events.listen">goog.events.listen</a> <span class="args">( src, type, listener, opt_capt, opt_handler )</span> ⇒ <code class="type"><a href="namespace_goog_events.html#goog.events.Key">goog.events.Key</a></code></span></div><p>Adds an event listener for a specific event on a native event
target (such as a DOM element) or an object that has implemented
<code class="type"><a href="interface_goog_events_Listenable.html">goog.events.Listenable</a></code>. 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().</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>The node to listen
to events on.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>.<EVENTOBJ>|!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>)</code><dd>Event type or array of event types.<dt>listener: <code class="type">(function(this: T, EVENTOBJ): ?|{handleEvent: function(?): ?}|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>)</code><dd>Callback method, or an object with a handleEvent function.
WARNING: passing an Object is now softly deprecated.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to fire in capture phase (defaults to
false).<dt>opt_handler: <code class="type">T=</code><dd>Element in whose scope to call the listener.</dl><tr><th>Returns<tr><td><dl>Unique key for the listener.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l316">code »</a><code class="type"><T, EVENTOBJ></code> <span class="member"><a name="goog.events.listenOnce">goog.events.listenOnce</a> <span class="args">( src, type, listener, opt_capt, opt_handler )</span> ⇒ <code class="type"><a href="namespace_goog_events.html#goog.events.Key">goog.events.Key</a></code></span></div><p>Adds an event listener for a specific event on a native event
target (such as a DOM element) or an object that has implemented
<code class="type"><a href="interface_goog_events_Listenable.html">goog.events.Listenable</a></code>. 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).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>The node to listen
to events on.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>.<EVENTOBJ>|!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>)</code><dd>Event type or array of event types.<dt>listener: <code class="type">(function(this: T, EVENTOBJ): ?|{handleEvent: function(?): ?}|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>)</code><dd>Callback method.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Fire in capture phase?.<dt>opt_handler: <code class="type">T=</code><dd>Element in whose scope to call the listener.</dl><tr><th>Returns<tr><td><dl>Unique key for the listener.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l353">code »</a><code class="type"><T></code> <span class="member"><a name="goog.events.listenWithWrapper">goog.events.listenWithWrapper</a> <span class="args">( src, wrapper, listener, opt_capt, opt_handler )</span></span></div><p>Adds an event listener with a specific event wrapper on a DOM Node or an
object that has implemented <code class="type"><a href="interface_goog_events_Listenable.html">goog.events.Listenable</a></code>. A listener can
only be added once to an object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>The target to
listen to events on.<dt>wrapper: <code class="type">goog.events.EventWrapper</code><dd>Event wrapper to use.<dt>listener: <code class="type">(function(this: T, ?): ?|{handleEvent: function(?): ?}|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>)</code><dd>Callback method, or an object with a handleEvent function.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to fire in capture phase (defaults to
false).<dt>opt_handler: <code class="type">T=</code><dd>Element in whose scope to call the listener.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l210">code »</a><span class="member"><a name="goog.events.listen_">goog.events.listen_</a> <span class="args">( src, type, listener, callOnce, opt_capt, opt_handler )</span> ⇒ <code class="type"><a href="interface_goog_events_ListenableKey.html">goog.events.ListenableKey</a></code></span></div><p>Adds an event listener for a specific event on a native event
target. 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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">EventTarget</code><dd>The node to listen to events on.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>)</code><dd>Event type.<dt>listener: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>Callback function.<dt>callOnce: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>Whether the listener is a one-off
listener or otherwise.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to fire in capture phase (defaults to
false).<dt>opt_handler: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Element in whose scope to call the listener.</dl><tr><th>Returns<tr><td><dl>Unique key for the listener.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l872">code »</a><span class="member"><a name="goog.events.markIeEvent_">goog.events.markIeEvent_</a> <span class="args">( e )</span></span></div><p>This is used to mark the IE event object so we do not do the Closure pass
twice for a bubbling event.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>e: <code class="type">Event</code><dd>The IE browser event.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l789">code »</a><span class="member"><a name="goog.events.protectBrowserEventEntryPoint">goog.events.protectBrowserEventEntryPoint</a> <span class="args">( errorHandler )</span></span></div><p>Installs exception protection for the browser event entry point using the
given error handler.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>errorHandler: <code class="type">goog.debug.ErrorHandler</code><dd>Error handler with which to
protect the entry point.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l498">code »</a><span class="member"><a name="goog.events.removeAll">goog.events.removeAll</a> <span class="args">( obj, opt_type )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Removes all listeners from an object. You can also optionally
remove listeners of a particular type.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code><dd>Object to remove listeners from. Must be an
EventTarget or a goog.events.Listenable.<dt>opt_type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>)=</code><dd>Type of event to remove.
Default is all types.</dl><tr><th>Returns<tr><td><dl>Number of listeners removed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l543">code »</a><span class="member deprecation-notice"><a name="goog.events.removeAllNativeListeners">goog.events.removeAllNativeListeners</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">This doesn't do anything, now that Closure no longer
stores a central listener registry.</span></div><p>Removes all native listeners registered via goog.events. Native
listeners are listeners on native browser objects (such as DOM
elements). In particular, goog.events.Listenable and
goog.events.EventTarget listeners will NOT be removed.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Number of listeners removed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l376">code »</a><code class="type"><EVENTOBJ></code> <span class="member"><a name="goog.events.unlisten">goog.events.unlisten</a> <span class="args">( src, type, listener, opt_capt, opt_handler )</span> ⇒ <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Removes an event listener which was added with listen().</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>The target to stop
listening to events on.<dt>type: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>|!<a href="class_goog_events_EventId.html">goog.events.EventId</a>.<EVENTOBJ>|!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>)</code><dd>Event type or array of event types to unlisten to.<dt>listener: <code class="type">(function(?): ?|{handleEvent: function(?): ?}|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>)</code><dd>The
listener function to remove.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>In DOM-compliant browsers, this determines
whether the listener is fired during the capture or bubble phase of the
event.<dt>opt_handler: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Element in whose scope to call the listener.</dl><tr><th>Returns<tr><td><dl>indicating whether the listener was there to remove.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l421">code »</a><span class="member"><a name="goog.events.unlistenByKey">goog.events.unlistenByKey</a> <span class="args">( key )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Removes an event listener which was added with listen() by the key
returned by listen().</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>key: <code class="type"><a href="namespace_goog_events.html#goog.events.Key">goog.events.Key</a></code><dd>The key returned by listen() for this
event listener.</dl><tr><th>Returns<tr><td><dl>indicating whether the listener was there to remove.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l482">code »</a><span class="member"><a name="goog.events.unlistenWithWrapper">goog.events.unlistenWithWrapper</a> <span class="args">( src, wrapper, listener, opt_capt, opt_handler )</span></span></div><p>Removes an event listener which was added with listenWithWrapper().</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type">(EventTarget|<a href="interface_goog_events_Listenable.html">goog.events.Listenable</a>)</code><dd>The target to stop
listening to events on.<dt>wrapper: <code class="type">goog.events.EventWrapper</code><dd>Event wrapper to use.<dt>listener: <code class="type">(function(?): ?|{handleEvent: function(?): ?}|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Null">null</a>)</code><dd>The
listener function to remove.<dt>opt_capt: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>In DOM-compliant browsers, this determines
whether the listener is fired during the capture or bubble phase of the
event.<dt>opt_handler: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Element in whose scope to call the listener.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l966">code »</a><span class="member"><a name="goog.events.wrapListener">goog.events.wrapListener</a> <span class="args">( listener )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>listener: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>)</code><dd>The listener function or an
object that contains handleEvent method.</dl><tr><th>Returns<tr><td><dl>Either the original function or a function that
calls obj.handleEvent. If the same listener is passed to this
function more than once, the same function is guaranteed to be
returned.</dl></table></div></details></div></div></section><section id="static-properties"><h2>Global Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l86">code »</a><span class="member"><a name="goog.events.LISTENER_MAP_PROP_">goog.events.LISTENER_MAP_PROP_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Property name on a native event target for the listener map
associated with the event target.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l954">code »</a><span class="member"><a name="goog.events.LISTENER_WRAPPER_PROP_">goog.events.LISTENER_WRAPPER_PROP_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Expando property for listener function wrapper for Object with
handleEvent.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l142">code »</a><span class="member"><a name="goog.events.listenerCountEstimate_">goog.events.listenerCountEstimate_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Estimated count of total native listeners.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l105">code »</a><span class="member"><a name="goog.events.onStringMap_">goog.events.onStringMap_</a> : <code class="type">{}</code></span></div><p>Map of computed "on<eventname>" strings for IE event types. Caching
this removes an extra object allocation in goog.events.listen which
improves IE6 performance.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l94">code »</a><span class="member"><a name="goog.events.onString_">goog.events.onString_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>String used to prepend to IE event types.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l920">code »</a><span class="member"><a name="goog.events.uniqueIdCounter_">goog.events.uniqueIdCounter_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Counter to create unique event ids.</summary></details></div></div></section><section id="compiler-constants"><h2>Compiler Constants</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/events/events.js.src.html#l135">code »</a><span class="member"><a name="goog.events.CAPTURE_SIMULATION_MODE">goog.events.CAPTURE_SIMULATION_MODE</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>Loading</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>Loading</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>Loading</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>