UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

7 lines 11.1 kB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>webdriver.EventEmitter</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class webdriver.EventEmitter</h1><a class="source" href="source/lib/webdriver/events.js.src.html#l29">code &raquo;</a></header><section><p>Object that can emit events for others to listen for. This is used instead of Closure's event system because it is much more light weight. The API is based on Node's EventEmitters.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">webdriver.EventEmitter <span class="args">( )</span></span></div></div></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="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l116">code &raquo;</a><span class="member"><a name="addListener">addListener</a> <span class="args">( type, listenerFn, opt_scope )</span> &rArr; <code class="type">!<a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a></code></span></div><p>Registers a listener.</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>The type of event to listen for.<dt>listenerFn: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function to invoke when the event is fired.<dt>opt_scope: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object in whose scope to invoke the listener.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l90">code &raquo;</a><span class="member"><a name="addListener_">addListener_</a> <span class="args">( type, listenerFn, opt_scope, opt_oneshot )</span> &rArr; <code class="type">!<a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a></code></span></div><p>Registers a listener.</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>The type of event to listen for.<dt>listenerFn: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function to invoke when the event is fired.<dt>opt_scope: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object in whose scope to invoke the listener.<dt>opt_oneshot: <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 should be removed after the first event is fired.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l44">code &raquo;</a><span class="member"><a name="emit">emit</a> <span class="args">( type, var_args )</span></span></div><p>Fires an event and calls all listeners.</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>The type of event to emit.<dt>var_args: <code class="type">...*</code><dd>Any arguments to pass to each listener.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l71">code &raquo;</a><span class="member"><a name="listeners">listeners</a> <span class="args">( type )</span> &rArr; <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code></span></div><p>Returns a mutable list of listeners for a specific type of event.</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>The type of event to retrieve the listeners for.</dl><tr><th>Returns<tr><td><dl>The registered listeners for the given event type.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l142">code &raquo;</a><span class="member"><a name="on">on</a> <span class="args">( type, listenerFn, opt_scope )</span> &rArr; <code class="type">!<a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a></code></span></div><p>An alias for <code >#addListener()</code>.</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>The type of event to listen for.<dt>listenerFn: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function to invoke when the event is fired.<dt>opt_scope: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object in whose scope to invoke the listener.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l130">code &raquo;</a><span class="member"><a name="once">once</a> <span class="args">( type, listenerFn, opt_scope )</span> &rArr; <code class="type">!<a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a></code></span></div><p>Registers a one-time listener which will be called only the first time an event is emitted, after which it will be removed.</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>The type of event to listen for.<dt>listenerFn: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function to invoke when the event is fired.<dt>opt_scope: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object in whose scope to invoke the listener.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l173">code &raquo;</a><span class="member"><a name="removeAllListeners">removeAllListeners</a> <span class="args">( opt_type )</span> &rArr; <code class="type">!<a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a></code></span></div><p>Removes all listeners for a specific type of event. If no event is specified, all listeners across all types will be removed.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_type: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>The type of event to remove listeners from.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l152">code &raquo;</a><span class="member"><a name="removeListener">removeListener</a> <span class="args">( type, listenerFn )</span> &rArr; <code class="type">!<a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a></code></span></div><p>Removes a previously registered event listener.</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>The type of event to unregister.<dt>listenerFn: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The handler function to remove.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/webdriver/events.js.src.html#l35">code &raquo;</a><span class="member"><a name="events_">events_</a> : <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Map of events to registered listeners.</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>