Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard

The DedicatedWorkerGlobalScope object (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers.

Link copied to clipboard
open class SharedWorker(scriptURL: TrustedScriptURL, options: String = definedExternally) : EventTarget, AbstractWorker

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.

Link copied to clipboard

The SharedWorkerGlobalScope object (the SharedWorker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See the complete list of functions available to workers.

Link copied to clipboard
open class Worker(scriptURL: TrustedScriptURL, options: WorkerOptions = definedExternally) : EventTarget, AbstractWorker, MessageEventTarget

The Worker interface of the Web Workers API represents a background task that can be created via script, which can send messages back to its creator.

Link copied to clipboard
sealed interface WorkerFactory<T : AbstractWorker>
Link copied to clipboard

The WorkerGlobalScope interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop.

Link copied to clipboard
open class WorkerLocation

The WorkerLocation interface defines the absolute location of the script executed by the Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.location property obtained by calling self.location.

Link copied to clipboard

The WorkerNavigator interface represents a subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the self.navigator property.

Link copied to clipboard
interface WorkerOptions
Link copied to clipboard
sealed interface WorkerType

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
external fun importScripts(vararg urls: String)

The importScripts() method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope.

external fun importScripts(vararg urls: URL)
Link copied to clipboard
inline operator fun <T : AbstractWorker> WorkerFactory<T>.invoke(): T
Link copied to clipboard
Link copied to clipboard