Event()
Event()
constructor는 새로운 Event
객체를 생성합니다.
Syntax
new Event(typeArg[, eventInit]);
Values
typeArg
- 이 인자는
DOMString
입니다. event의 이름을 나타냅니다. eventInit
Optional- 이 인자는
EventInit
dictionary, 입니다. 아래의 추가 옵션 필드가 있습니다.bubbles
:Boolean
값을 받습니다. 해당 event가 bubble인지 아닌지 결정합니다. 기본값은false
입니다.cancelable
:Boolean
값을 받습니다.event가 캔슬 될 수 있는지 없는지 결정합니다. 기본값은false
입니다.composed
:Boolean
값을 받습니다. event가 shadow root 바깥의 eventListener 들도 trigger 할 것인지 결정합니다. (더 자세한 내용은 이곳에서Event.composed
). 기본값은false
입니다.
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 dispatched from any element, not only the document
myDiv.dispatchEvent(evt);
Specifications
Specification | Status | Comment |
---|---|---|
DOM The definition of 'Event()' in that specification. |
Living Standard | Initial definition |
Browser compatibility
BCD tables only load in the browser