This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The Event() constructor creates a new Event object. An event created in this way is called a synthetic event, as opposed to an event fired by the browser, and can be dispatched by a script.
new Event(type) new Event(type, options)
typeA string with the name of the event.
options OptionalAn object with the following properties:
bubbles OptionalA boolean value indicating whether the event bubbles. The default is false.
cancelable OptionalA boolean value indicating whether the event can be cancelled. The default is false.
composed OptionalA boolean value indicating whether the event will trigger listeners outside of a shadow root (see Event.composed for more details). The default is false.
A new Event object.
// create a look event that bubbles up and cannot be canceled
const evt = new Event("look", { bubbles: true, cancelable: false });
document.dispatchEvent(evt);
// event can be dispatched from any element, not only the document
myDiv.dispatchEvent(evt);
| Specification |
|---|
| DOM> # ref-for-dom-event-event> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Event |
15 | 12 | 11 | 11.6 | 6 | 18 | 14 | 12 | 6 | 1.0 | 4.4 | 6 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Event/Event