The Event() constructor builds a synthetic Event you can inspect or send with dispatchEvent(). Learn type, bubbles, cancelable, composed, isTrusted, and how it compares to MouseEvent / CustomEvent—with five examples and try-it labs.
01
Create
new Event()
02
Type
Event name string
03
Options
bubbles / cancelable
04
Shadow
composed
05
Fire
dispatchEvent()
06
Status
Baseline widely
Fundamentals
Introduction
Browsers create many events for you (clicks, scrolls, loads). Sometimes your script needs to create one too—for tests, custom app signals, or triggering the same listeners without a real user gesture.
new Event("look", options) returns that object. MDN calls it a synthetic event (script-made), as opposed to a browser-fired event. Pair it with target.dispatchEvent(event) to run handlers.
💡
Beginner tip
Creating an event does not fire it. You must call dispatchEvent (or an API that dispatches for you). Synthetic events have isTrusted === false.
Concept
Understanding the Event() Constructor
Pass an event type string and an optional options object. The constructor returns a new Event instance ready to inspect or dispatch.
type — the event name (for example "look" or "change").
bubbles — whether the event bubbles up the tree (default false).
cancelable — whether preventDefault() can cancel it (default false).
composed — whether it can cross shadow DOM boundaries (default false).
Workers — available in Web Workers as well as window contexts.
Foundation
📝 Syntax
JavaScript
new Event(type)
new Event(type, options)
Parameters
type — A string with the name of the event.
options(optional) — An object with the fields below.
Option fields (MDN)
Option
Default
Meaning
bubbles
false
Whether the event bubbles
cancelable
false
Whether the event can be cancelled
composed
false
Whether it triggers listeners outside a shadow root
Return value
A new Event object.
Compare
⚖️ Event vs Related Constructors
Constructor
Use when
new Event(type)
Simple named signal; no extra payload
new CustomEvent(type, { detail })
You need a custom detail value
new MouseEvent(type, options)
You need mouse coords, buttons, modifiers
new EventTarget()
You need an object that can listen / dispatch
Cheat Sheet
⚡ Quick Reference
Goal
Code
Create a simple event
new Event("look")
Bubbling, not cancelable
new Event("look", { bubbles: true, cancelable: false })
Fire on document
document.dispatchEvent(evt)
Fire on an element
myDiv.dispatchEvent(evt)
Check synthetic?
event.isTrusted === false
MDN status
Baseline Widely available (since July 2015)
Snapshot
🔍 At a Glance
Four facts to remember about new Event().
Returns
Event
Synthetic object
Baseline
widely
Since July 2015
Trusted?
false
Script-made
Dispatch
dispatchEvent
To fire handlers
Hands-On
Examples Gallery
Examples follow MDN Event(). Use View Output or Try It Yourself.
MDN’s classic look example uses bubbles: true and cancelable: false.
📈 Dispatch, Trust & Compare
Fire synthetic events and choose the right constructor.
Example 3 — Create and Dispatch (MDN)
Build a bubbling look event and dispatch it on an element.
JavaScript
const myDiv = document.getElementById("myDiv");
const out = document.getElementById("out");
myDiv.addEventListener("look", () => {
out.textContent = "look event received!";
});
// create a look event that bubbles up and cannot be canceled
const evt = new Event("look", { bubbles: true, cancelable: false });
// event can be dispatched from any element, not only the document
myDiv.dispatchEvent(evt);
The Event() constructor is Baseline Widely available across modern browsers (MDN: since July 2015). Logos use the shared browser-image-sprite.png sprite from this project. It is also available in Web Workers.
✓ Baseline · Widely available
Event() constructor
Safe API for building synthetic Event objects and dispatching them in apps, tests, and demos.
UniversalWidely available
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerSupported in modern IE versions
Full support
Event()Excellent
Bottom line: Create Event objects with type + options; dispatch with EventTarget.dispatchEvent. Use CustomEvent or MouseEvent when you need more fields.
Wrap Up
Conclusion
new Event(type, options) builds a synthetic event with the bubbling and cancelability you choose. Dispatch it to exercise listeners, and use CustomEvent or MouseEvent when you need richer data.
Build synthetic events, then dispatch when needed.
5
Core concepts
⚡01
new Event
type + options
API
🔁02
bubbles
default false
Options
🔒03
isTrusted
false if synthetic
Security
🔔04
dispatchEvent
fires handlers
Use
🎯05
Baseline
since Jul 2015
Status
❓ Frequently Asked Questions
new Event(type, options) creates an Event object. Events built this way are called synthetic events. You can inspect them or send them with target.dispatchEvent(event).
No. MDN marks the Event() constructor as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
An optional options object may include bubbles (default false), cancelable (default false), and composed (default false). composed controls whether the event can cross shadow DOM boundaries.
Create it with new Event("my-event", { bubbles: true }), then call element.dispatchEvent(event) or document.dispatchEvent(event). Listeners registered for that type will run.
Browser-generated events have isTrusted === true. Events you create with new Event() have isTrusted === false. Handlers can use that to tell real user input from script-made events.
Use CustomEvent when you need a detail payload. Use MouseEvent (or other UIEvent subclasses) when you need mouse coordinates, buttons, or similar fields. Use Event for a simple named signal with no extra data.
Did you know?
MDN’s classic demo creates a custom "look" event—any string name works. You are not limited to built-in names like click or load.