18 lines
550 B
JavaScript
18 lines
550 B
JavaScript
self.importScripts('utils.js');
|
|
|
|
self.onmessage = function(e) {
|
|
var key = e.data.key;
|
|
var url = e.data.url;
|
|
|
|
e.waitUntil(self.clients.claim().then(() => {
|
|
return self.clients.matchAll({type: 'window'});
|
|
}).then(clients => {
|
|
return clients.map(client => {
|
|
// Check to make sure WindowClient.navigate() is supported.
|
|
if (client.url === url) {
|
|
return client.navigate(generateURL('serviceWorker-navigate-inner-success.html',
|
|
[key]));
|
|
}
|
|
});
|
|
}));
|
|
};
|