BroadcastChannel
interface
interface BroadcastChannel extends EventTargetRepresents a named channel that any
BroadcastChannel with the same name (across workers or isolates
in the same Ende process) can use to send and receive messages, allowing
one-to-many communication between execution contexts.
variable
var BroadcastChannel: { … }The constructor object for BroadcastChannel.
Construct a channel with new BroadcastChannel(name) to join the channel
identified by name; messages posted on it are delivered to every other
BroadcastChannel connected to the same name.
Constructors
constructor
new BroadcastChannel(name: string): BroadcastChannelProperties
name
readonly name: stringReturns the channel name (as passed to the constructor).
onmessage
onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | nullonmessageerror
onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | nullprototype
readonly prototype: BroadcastChannelMethods
close
close(): voidCloses the BroadcastChannel object, opening it up to garbage collection.
postMessage
postMessage(message: any): voidSends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays.
addEventListener
addEventListener<K extends keyof BroadcastChannelEventMap>(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): voidaddEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): voidremoveEventListener
removeEventListener<K extends keyof BroadcastChannelEventMap>(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | EventListenerOptions): voidremoveEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void