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
See alsoEdit
The Worker
interface it belongs to.