MessageEvent
The MessageEvent
interface represents a message received by a target object.
Properties
The cancelable
read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
The currentTarget
read-only property of the Event interface identifies the element to which the event handler has been attached.
The defaultPrevented
read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
The eventPhase
read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
The isTrusted
read-only property of the Event interface is a boolean value that is true
when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and false
when the event was dispatched via EventTarget.dispatchEvent().
The lastEventId
read-only property of the MessageEvent interface is a string representing a unique ID for the event.
The ports
read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
The source
read-only property of the MessageEvent interface is a MessageEventSource
(which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
The read-only target
property of the Event interface is a reference to the object onto which the event was dispatched.
The timeStamp
read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
Functions
The composedPath()
method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
The preventDefault()
method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken.
The stopImmediatePropagation()
method of the Event interface prevents other listeners of the same event from being called.
The stopPropagation()
method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.