mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
Display a message when a service worker updates
This commit is contained in:
parent
f919b227a3
commit
8bc26fe316
@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user