Worker: terminate() method - Web APIs | MDN (original) (raw)

The terminate() method of the Worker interface immediately terminates the Worker. This does not offer the worker an opportunity to finish its operations; it is stopped at once.

Syntax

Parameters

None.

Return value

Examples

The following code snippet shows creation of a Worker object using the Worker() constructor, which is then immediately terminated.

const myWorker = new Worker("worker.js");

myWorker.terminate();

Specifications

Specification
HTML Standard # dom-worker-terminate-dev

Browser compatibility

BCD tables only load in the browser

See also