Skip to content

Commit

Permalink
Merge pull request #7 from interledger/fix-serviceworker
Browse files Browse the repository at this point in the history
add a no-op service worker for previous installations
  • Loading branch information
Matthew de Haast committed Oct 2, 2019
2 parents 39e546b + 83b4b3e commit 5b6630b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions website/static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ window.addEventListener('load', function() {
clipboard.on('success', function(event) {
event.clearSelection();
})
navigator.serviceWorker.register('/service-worker.js');
})

function setpp(event) {
Expand Down
22 changes: 22 additions & 0 deletions website/static/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// A simple, no-op service worker that takes immediate control.

self.addEventListener('install', () => {
// Skip over the "waiting" lifecycle state, to ensure that our
// new service worker is activated immediately, even if there's
// another tab open controlled by our older service worker code.
self.skipWaiting();
});

/*
self.addEventListener('activate', () => {
// Optional: Get a list of all the current open windows/tabs under
// our service worker's control, and force them to reload.
// This can "unbreak" any open windows/tabs as soon as the new
// service worker activates, rather than users having to manually reload.
self.clients.matchAll({type: 'window'}).then(windowClients => {
windowClients.forEach(windowClient => {
windowClient.navigate(windowClient.url);
});
});
});
*/

0 comments on commit 5b6630b

Please sign in to comment.