Skip to content

Commit

Permalink
Service worker skipWaiting
Browse files Browse the repository at this point in the history
  • Loading branch information
mk committed Sep 11, 2023
1 parent d64677d commit 51ec1cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions resources/public/clerk_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ const hosts = [
];

self.addEventListener('install', function(event) {
console.log('Service Worker: Installed');
//console.log('install', event);
self.skipWaiting();
});

self.addEventListener('activate', function(event) {
console.log('Service Worker: Activated');
//console.log('activate', event);

// Remove unwanted caches
event.waitUntil(
Expand All @@ -30,7 +31,7 @@ self.addEventListener('activate', function(event) {
});

self.addEventListener('fetch', function(event) {
console.log("Service Worker: Fetching", event);
//console.log(event);

event.respondWith(
caches.match(event.request).then(function(response) {
Expand All @@ -48,4 +49,4 @@ self.addEventListener('fetch', function(event) {
});
})
);
});
});
2 changes: 1 addition & 1 deletion src/nextjournal/clerk/view.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/clerk_service_worker.js')
.then(function() { console.log('Service Worker: Registered') })
//.then(function() { console.log('Service Worker: Registered') })
.catch(function(error) { console.log('Service Worker: Error', error) })
}"])
(when current-path (v/open-graph-metas (-> state :path->doc (get current-path) v/->value :open-graph)))
Expand Down

0 comments on commit 51ec1cb

Please sign in to comment.