blob: 6da397dd15268bec568fef1b5f8112d862e88970 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
function matchQuery(query) {
return self.location.href.indexOf(query) != -1;
}
if (matchQuery('?evaluation'))
self.registration.unregister();
self.addEventListener('install', function(e) {
if (matchQuery('?install')) {
// Don't do waitUntil(unregister()) as that would deadlock as specified.
self.registration.unregister();
}
});
self.addEventListener('activate', function(e) {
if (matchQuery('?activate'))
e.waitUntil(self.registration.unregister());
});
self.addEventListener('message', function(e) {
e.waitUntil(self.registration.unregister()
.then(function(result) {
e.data.port.postMessage({result: result});
}));
});
|