Class: Event

events~Event

A class that provides an event API similar to WebExtensions events.Event objects. Use the createEvent function to create an Event object.

Source:

Methods

addListener(listener, options)

Add an event listener with the specified options. If the listener has previously been added for the event, the listener's options will be updated.

Parameters:
Name Type Description
listener function

The listener to call when the event fires.

options Object

Options for when the listener should be called.

Source:

hasAnyListeners() → {boolean}

Check whether there are any listeners for the event.

Source:
Returns:

Whether there are any listeners for the event.

Type
boolean

hasListener(listener) → {boolean}

Check whether a particular event listener has been added.

Parameters:
Name Type Description
listener EventCallbackFunction

The listener to check.

Source:
Returns:

Whether the listener has been added.

Type
boolean

notifyListeners(listenerArgumentsopt)

Notify the listeners for the event.

Parameters:
Name Type Attributes Default Description
listenerArguments Array <optional>
[]

The arguments that will be passed to the listeners.

Source:

removeListener(listener)

Remove an event listener.

Parameters:
Name Type Description
listener function

The listener to remove.

Source: