Handle page resizes on history, bumped to v12

This commit is contained in:
Magnus Åhall 2026-06-07 11:48:10 +02:00
parent 7002a00972
commit 9c07611f95
6 changed files with 108 additions and 195 deletions

View file

@ -6,6 +6,7 @@ const CACHED_ASSETS = [
'/css/{{ .VERSION }}/main.css',
'/css/{{ .VERSION }}/markdown.css',
'/css/{{ .VERSION }}/notes2.css',
'/css/{{ .VERSION }}/page_history.css',
'/css/{{ .VERSION }}/theme.css',
'/images/{{ .VERSION }}/collapsed.svg',
@ -119,9 +120,13 @@ self.addEventListener('activate', event => {
})
self.addEventListener('fetch', event => {
// console.debug('SERVICE WORKER: fetch', event.request.url)
// The fetch event is also seeing requests to other domains.
// Just let the browser handle those for itself.
const ourDomain = event.request.url.startsWith(self.location.origin)
if (!ourDomain)
return event
if ({{ .DevMode }})
if (`{{ .DevMode }}` == 'true')
return event
event.respondWith(fetchAsset(event))