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.
myWorker.terminate();
None.
Void.
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();
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'Worker.terminate()' in that specification. | Living Standard |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 4 | 12 | 3.5 | 10 | 10.6 | 4 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 4 | 18 | Yes | 4 | 11.5 | 5.1 | Yes |
The Worker interface it belongs to.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Worker/terminate