Immediately terminates the worker. This does not let worker finish its operations; it is halted at once. ServiceWorker instances do not support this method.
Fires when a Promise rejects with no handler to catch the rejection.
Example
The following code snippet creates a Worker object using the Worker() constructor, then uses the worker object:
var myWorker =newWorker('/worker.js');var first = document.querySelector('input#number1');var second = document.querySelector('input#number2');
first.onchange=function(){
myWorker.postMessage([first.value, second.value]);
console.log('Message posted to worker');}