Class webdriver.EventEmitter
Defined in: events.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Object that can emit events for others to listen for.
|
Field Attributes | Field Name and Description |
---|---|
An alias for {@code #addListener()}.
|
Method Attributes | Method Name and Description |
---|---|
addListener(type, listenerFn, opt_scope)
Registers a listener.
|
|
emit(type, var_args)
Fires an event and calls all listeners.
|
|
listeners(type)
Returns a mutable list of listeners for a specific type of event.
|
|
once(type, listenerFn, opt_scope)
Registers a one-time listener which will be called only the first time an
event is emitted, after which it will be removed.
|
|
removeAllListeners(opt_type)
Removes all listeners for a specific type of event.
|
|
removeListener(type, listenerFn)
Removes a previously registered event listener.
|
Class Detail
webdriver.EventEmitter()
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.
Field Detail
{!webdriver.EventEmitter}
on
An alias for {@code #addListener()}.
Method Detail
{!webdriver.EventEmitter}
addListener(type, listenerFn, opt_scope)
Registers a listener.
- Parameters:
- {string} type
- The type of event to listen for.
- {!Function} listenerFn
- The function to invoke when the event is fired.
- {Object=} opt_scope
- The object in whose scope to invoke the listener.
- Returns:
- {!webdriver.EventEmitter} A self reference.
emit(type, var_args)
Fires an event and calls all listeners.
- Parameters:
- {string} type
- The type of event to emit.
- {...*} var_args
- Any arguments to pass to each listener.
{!Array.<{fn: !Function|oneshot: boolean|scope: (Object|undefined)}>}
listeners(type)
Returns a mutable list of listeners for a specific type of event.
- Parameters:
- {string} type
- The type of event to retrieve the listeners for.
- Returns:
- {!Array.<{fn: !Function|oneshot: boolean|scope: (Object|undefined)}>} The registered listeners for the given event type.
{!webdriver.EventEmitter}
once(type, listenerFn, opt_scope)
Registers a one-time listener which will be called only the first time an
event is emitted, after which it will be removed.
- Parameters:
- {string} type
- The type of event to listen for.
- {!Function} listenerFn
- The function to invoke when the event is fired.
- {Object=} opt_scope
- The object in whose scope to invoke the listener.
- Returns:
- {!webdriver.EventEmitter} A self reference.
{!webdriver.EventEmitter}
removeAllListeners(opt_type)
Removes all listeners for a specific type of event. If no event is
specified, all listeners across all types will be removed.
- Parameters:
- {string=} opt_type
- The type of event to remove listeners from.
- Returns:
- {!webdriver.EventEmitter} A self reference.
{!webdriver.EventEmitter}
removeListener(type, listenerFn)
Removes a previously registered event listener.
- Parameters:
- {string} type
- The type of event to unregister.
- {!Function} listenerFn
- The handler function to remove.
- Returns:
- {!webdriver.EventEmitter} A self reference.