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

Functions

Link copied to clipboard
fun close()

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

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

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

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