Worker.terminate()

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 simply stopped at once.

SyntaxEdit

myWorker.terminate();

Parameters

None.

Returns

Void.

ExampleEdit

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

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

myWorker.terminate();

SpecificationsEdit

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'Worker.postMessage()' in that specification.
Living Standard No change from Web Workers.
Web Workers
The definition of 'Worker.postMessage()' in that specification.
Candidate Recommendation Initial definition.

Browser compatibilityEdit

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 4 3.5 10.0 10.6 4

See alsoEdit

The Worker interface it belongs to.

Document Tags and Contributors

 Contributors to this page: teoli, jean-pierre.gay, chrisdavidmills, kscarfone
 Last updated by: teoli,