BroadcastChannel

open class BroadcastChannel(val name: String) : EventTarget(source)

The BroadcastChannel interface represents a named channel that any browsing context of a given origin can subscribe to.

MDN Reference

Constructors

Link copied to clipboard
constructor(name: String)

Properties

Link copied to clipboard

The name read-only property of the BroadcastChannel interface returns a string, which uniquely identifies the given channel with its name.

Functions

Link copied to clipboard
fun close()

The close() method of the BroadcastChannel interface terminates the connection to the underlying channel, allowing the object to be garbage collected.

Link copied to clipboard
Link copied to clipboard
fun postMessage(message: JsAny?)

The postMessage() method of the BroadcastChannel interface sends a message, which can be of any kind of Object, to each listener in any browsing context with the same origin.

Link copied to clipboard
fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions? = definedExternally): Observable<T>