SharedWorker

open class SharedWorker(scriptURL: TrustedScriptURL, options: String = definedExternally) : EventTarget, AbstractWorker(source)

The SharedWorker interface represents a specific kind of worker that can be accessed from several browsing contexts, such as several windows, iframes or even workers. They implement an interface different than dedicated workers and have a different global scope, SharedWorkerGlobalScope.

MDN Reference

Constructors

Link copied to clipboard
constructor(scriptURL: TrustedScriptURL, options: String = definedExternally)
constructor(scriptURL: TrustedScriptURL, options: WorkerOptions)
constructor(scriptURL: String, options: String = definedExternally)
constructor(scriptURL: String, options: WorkerOptions)
constructor(scriptURL: URL, options: String = definedExternally)
constructor(scriptURL: URL, options: WorkerOptions)

Properties

Link copied to clipboard

The port property of the SharedWorker interface returns a MessagePort object used to communicate and control the shared worker.

Functions

Link copied to clipboard
open fun dispatchEvent(event: Event): Boolean
Link copied to clipboard