Skip to main content

BroadcastChannel

interface BroadcastChannel
extends EventTarget
unstable

Properties Jump to heading

readonly
Jump to headingname: string

Returns the channel name (as passed to the constructor).

Closes the BroadcastChannel object, opening it up to garbage collection.

Jump to headingpostMessage(message: any): void

Sends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays.

Jump to headingaddEventListener<K extends keyof BroadcastChannelEventMap>(
type: K,
listener: () => any,
options?: boolean | AddEventListenerOptions,
): void
Jump to headingremoveEventListener<K extends keyof BroadcastChannelEventMap>(
type: K,
listener: () => any,
options?: boolean | EventListenerOptions,
): void
Back to top