← Back to index
interface BroadcastChannel
extends EventTarget

Properties

🔗
name: string

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

🔗
onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null
🔗
onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null

Methods

🔗
close(): void

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

🔗
postMessage(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.

🔗
addEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void
🔗
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void
🔗
removeEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | EventListenerOptions): void
🔗
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void