class EventEmitter

Alias for 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.

new EventEmitter()

Parameters
None.

Instance Methods

addListener(type, listenerFn, opt_scope)code »

Registers a listener.

Parameters
typestring

The type of event to listen for.

listenerFnFunction

The function to invoke when the event is fired.

opt_scope?Object=

The object in whose scope to invoke the listener.

Returns
webdriver.EventEmitter

A self reference.


emit(type, var_args)code »

Fires an event and calls all listeners.

Parameters
typestring

The type of event to emit.

var_args...*

Any arguments to pass to each listener.


listeners(type)code »

Returns a mutable list of listeners for a specific type of event.

Parameters
typestring

The type of event to retrieve the listeners for.

Returns
Array<{fn: Function, oneshot: boolean, scope: ?(Object)}>

The registered listeners for the given event type.


on(type, listenerFn, opt_scope)code »

An alias for #addListener().

Parameters
typestring

The type of event to listen for.

listenerFnFunction

The function to invoke when the event is fired.

opt_scope?Object=

The object in whose scope to invoke the listener.

Returns
webdriver.EventEmitter

A self reference.


once(type, listenerFn, opt_scope)code »

Registers a one-time listener which will be called only the first time an event is emitted, after which it will be removed.

Parameters
typestring

The type of event to listen for.

listenerFnFunction

The function to invoke when the event is fired.

opt_scope?Object=

The object in whose scope to invoke the listener.

Returns
webdriver.EventEmitter

A self reference.


removeAllListeners(opt_type)code »

Removes all listeners for a specific type of event. If no event is specified, all listeners across all types will be removed.

Parameters
opt_typestring=

The type of event to remove listeners from.

Returns
webdriver.EventEmitter

A self reference.


removeListener(type, listenerFn)code »

Removes a previously registered event listener.

Parameters
typestring

The type of event to unregister.

listenerFnFunction

The handler function to remove.

Returns
webdriver.EventEmitter

A self reference.