-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-browser.js
31 lines (27 loc) · 882 Bytes
/
gatsby-browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
// Polyfills - https://github.com/gatsbyjs/gatsby/issues/10821
import 'core-js/es6/set';
import 'core-js/es6/map';
import 'raf/polyfill';
export const onServiceWorkerUpdateReady = () => {
const answer = window.confirm(
`This application has been updated. ` +
`Reload to display the latest version?`
);
if (answer === true) {
window.location.reload();
}
};
// https://www.gatsbyjs.org/packages/gatsby-background-image/#install
export const onClientEntry = () => {
// IntersectionObserver polyfill for gatsby-background-image (Safari, IE)
if (typeof window.IntersectionObserver === `undefined`) {
import(`intersection-observer`);
// eslint-disable-next-line no-console
console.log(`# IntersectionObserver is polyfilled!`);
}
};