mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-02 08:20:22 +01:00
display a message when a service worker updates
This commit is contained in:
parent
8db979896e
commit
e164622b52
@ -5,3 +5,15 @@ import './src/styles/global.scss'
|
||||
if (typeof window.IntersectionObserver === 'undefined') {
|
||||
import('intersection-observer')
|
||||
}
|
||||
|
||||
// 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