Der Konstruktor: Event()
erstellt ein neues Event
.
Syntax
event = new Event(typeArg, eventInit);
Values
- typeArg
- ist ein
DOMString
und bestimmt den Namen des Events. - eventInit Optional
- ist ein
Object
und beinhaltet folgende Felder:"bubbles"
: (Optional) EinBoolean
, welcher angibt, ob das Event gebubbled werden soll. Der Standardwert istfalse
."cancelable"
: (Optional) EinBoolean
, welcher angibt, ob das Event abgebrochen werden kann. Der Standardwertfalse
."composed"
: (Optional) EinBoolean
, welcher angibt, ob das Event auch außerhalb eines Shadow-Root-Elements empfangen werden kann. Der Standardwert istfalse
.
Example
// create a look event that bubbles up and cannot be canceled
var evt = new Event("look", {"bubbles":true, "cancelable":false});
document.dispatchEvent(evt);
// event can be dispached from any elmement, not only the document
myDiv.dispatchEvent(evt);
Specifications
Specification | Status | Comment |
---|---|---|
DOM Die Definition von 'Event()' in dieser Spezifikation. |
Lebender Standard | Initial definition. |
Browser compatibility
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.