1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +01:00

Display a message when a service worker updates

This commit is contained in:
Matthias Kretschmann 2019-11-09 20:09:06 +01:00
parent f919b227a3
commit 8bc26fe316
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -22,3 +22,15 @@ wrapRootElement.propTypes = {
// Layout with Page Transitions // Layout with Page Transitions
export const wrapPageElement = wrapPageElementWithLayout export const wrapPageElement = wrapPageElementWithLayout
// Display a message when a service worker updates
// https://www.gatsbyjs.org/docs/add-offline-support-with-a-service-worker/#displaying-a-message-when-a-service-worker-updates
export const onServiceWorkerUpdateReady = () => {
const answer = window.confirm(
`This application has been updated. ` +
`Reload to display the latest version?`
)
if (answer === true) {
window.location.reload()
}
}