tenfourfox/dom/workers/test/serviceworkers/worker_unregister.js

17 lines
349 B
JavaScript
Raw Normal View History

2017-04-19 07:56:45 +00:00
onmessage = function(e) {
clients.matchAll().then(function(c) {
if (c.length === 0) {
// We cannot proceed.
return;
}
registration.unregister().then(function() {
c[0].postMessage('DONE');
}, function() {
c[0].postMessage('ERROR');
}).then(function() {
c[0].postMessage('FINISH');
});
});
}