What is the MessageEvent class in Deno?

What is Deno?

Deno is a small, general-purpose runtime environment for JavaScript with first-class support for various interfaces, ECMAScript modules, and seamless TypeScript integration.

Class MessageEvent

Class MessageEvent returns a message passed as a parameter to its constructor:

class MessageEvent extends Event

Constructors

// message is of type string
constructor(type: string, eventInitDict?: MessageEventInit)

Properties

// data is the message
readonly data: any
// where is message coming from
readonly origin: string
readonly lastEventId: string

Syntax

interface MessageEventInit extends EventInit {
  data?: any;
  origin?: string;
  lastEventId?: string;
}

declare class MessageEvent extends Event {
  readonly data: any;
  readonly origin: string;
  readonly lastEventId: string;
  constructor(type: string, eventInitDict?: MessageEventInit);
}

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved