1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-23 09:45:56 +01:00
blog/gatsby-browser.js

20 lines
822 B
JavaScript
Raw Normal View History

2018-09-24 01:09:50 +02:00
import './src/styles/global.scss'
2018-07-18 00:24:11 +02:00
2018-09-24 01:09:50 +02:00
// IntersectionObserver polyfill for gatsby-image (Safari, IE)
if (typeof window.IntersectionObserver === 'undefined') {
import('intersection-observer')
2018-07-18 00:24:11 +02:00
}
import wrapPageElementWithLayout from './src/helpers/wrapPageElement'
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 div = document.createElement('div')
div.id = 'toast'
div.classList.add('alert', 'alert-info')
div.innerHTML = `<button onClick="window.location.reload()">This application has been updated. <span>Click to Reload</span>.</button>`
document.body.append(div)
}