All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.web.messaging.MessageEvent.kt Maven / Gradle / Ivy

package web.messaging

import kotlinx.js.ReadonlyArray
import web.events.Event
import web.events.EventInit

external interface MessageEventInit : EventInit {
    var data: T
    var lastEventId: String?
    var origin: String?
    var ports: ReadonlyArray
    var source: MessageEventSource?
}

external class MessageEvent(
    type: String,
    eventInitDict: MessageEventInit = definedExternally
) : Event {
    /** Returns the data of the message. */
    val data: T

    /** Returns the last event ID string, for server-sent events. */
    val lastEventId: String

    /** Returns the origin of the message, for server-sent events and cross-document messaging. */
    val origin: String

    /** Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging. */
    val ports: ReadonlyArray

    /** Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects. */
    val source: MessageEventSource?

    companion object
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy