Firefox Tomorrow

web api interface

CustomEvent

View on MDN ↗

Available in workers

The CustomEvent interface can be used to attach custom data to an event generated by an application.

As an alternative to CustomEvent, you can subclass the Event interface to add custom data and behavior.

[!NOTE] If used to attempt to communicate between a web extension content script and a web page script, a non-string detail property throws with “Permission denied to access property” in Firefox. To avoid this issue clone the object. See Share objects with page scripts for more information.

Constructor

Instance properties

This interface inherits properties from its parent, Event.

  • detail Read only
    • : Returns any data passed when initializing the event.

Instance methods

This interface inherits methods from its parent, Event.

  • initCustomEvent() Deprecated
    • : Initializes a CustomEvent object. If the event has already been dispatched, this method does nothing.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also