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

main.web.workers.Worker.kt Maven / Gradle / Ivy

// Automatically generated - do not modify!

package web.workers

import js.core.ReadonlyArray
import web.events.EventHandler
import web.events.EventTarget
import web.messaging.MessageEvent
import web.messaging.StructuredSerializeOptions
import web.messaging.Transferable
import web.url.URL

open external class Worker(
    scriptURL: String,
    options: WorkerOptions = definedExternally,
) : EventTarget,
    AbstractWorker {
    constructor(
        scriptURL: URL,
        options: WorkerOptions = definedExternally,
    )

    var onmessage: EventHandler>?
    var onmessageerror: EventHandler>?

    /** Clones message and transmits it to worker's global environment. transfer can be passed as a list of objects that are to be transferred rather than cloned. */
    fun postMessage(
        message: Any?,
        transfer: ReadonlyArray,
    )

    fun postMessage(
        message: Any?,
        options: StructuredSerializeOptions = definedExternally,
    )

    /** Aborts worker's associated global environment. */
    fun terminate()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy