Skip to content

Commit

Permalink
refresh on sw install
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Oct 3, 2024
1 parent 86e31e9 commit aa8cb1f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions public/bento.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ async function registerServiceWorker() {
} catch (error) {
console.error(`Registration failed with ${error}`)
}
let ref = false
navigator.serviceWorker.addEventListener("controllerchange", function () {
if (ref) return
ref = true
window.location.reload()
})
}
}

Expand Down

0 comments on commit aa8cb1f

Please sign in to comment.