Worker

open external class Worker : EventTarget, AbstractWorker (source)

Platform and version requirements: JS

Exposes the JavaScript Worker to Kotlin

Constructors

<init>

Worker(
    scriptURL: String,
    options: WorkerOptions = definedExternally)

Exposes the JavaScript Worker to Kotlin

Properties

onerror

open var onerror: (Event) -> dynamic

onmessage

var onmessage: (Event) -> dynamic

Functions

postMessage

fun postMessage(
    message: Any?,
    transfer: Array<dynamic> = definedExternally)

terminate

fun terminate()

Inherited Functions

addEventListener

fun addEventListener(
    type: String,
    callback: EventListener?,
    options: dynamic = definedExternally)
fun addEventListener(
    type: String,
    callback: (Event) -> Unit,
    options: dynamic = definedExternally)

dispatchEvent

fun dispatchEvent(event: Event): Boolean

removeEventListener

fun removeEventListener(
    type: String,
    callback: EventListener?,
    options: dynamic = definedExternally)
fun removeEventListener(
    type: String,
    callback: (Event) -> Unit,
    options: dynamic = definedExternally)