worker_unregister.js (420B)
1 onmessage = function (e) { 2 clients.matchAll().then(function (c) { 3 if (c.length === 0) { 4 // We cannot proceed. 5 return; 6 } 7 8 registration 9 .unregister() 10 .then( 11 function () { 12 c[0].postMessage("DONE"); 13 }, 14 function () { 15 c[0].postMessage("ERROR"); 16 } 17 ) 18 .then(function () { 19 c[0].postMessage("FINISH"); 20 }); 21 }); 22 };