2018-01-15 02:13:42 +01:00
|
|
|
import { init } from 'sapper/runtime.js'
|
2018-01-15 18:43:48 +01:00
|
|
|
import { importURLSearchParams } from '../routes/_utils/asyncModules'
|
2018-01-17 05:34:09 +01:00
|
|
|
import { importIntersectionObserver } from '../routes/_utils/asyncModules'
|
2018-01-07 00:51:25 +01:00
|
|
|
|
2018-01-08 08:00:15 +01:00
|
|
|
// polyfills
|
|
|
|
Promise.all([
|
2018-01-17 05:34:09 +01:00
|
|
|
typeof URLSearchParams === 'undefined' && importURLSearchParams(),
|
|
|
|
typeof IntersectionObserver === 'undefined' && importIntersectionObserver()
|
2018-01-08 08:00:15 +01:00
|
|
|
]).then(() => {
|
|
|
|
// `routes` is an array of route objects injected by Sapper
|
|
|
|
init(document.querySelector('#sapper'), __routes__)
|
2018-01-15 02:13:42 +01:00
|
|
|
|
|
|
|
if (navigator.serviceWorker && navigator.serviceWorker.controller) {
|
|
|
|
navigator.serviceWorker.controller.onstatechange = (e) => {
|
|
|
|
if (e.target.state === 'redundant') {
|
2018-01-15 02:50:29 +01:00
|
|
|
importToast().then(toast => toast.say('App update available. Reload to update.'));
|
2018-01-15 02:13:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-08 08:00:15 +01:00
|
|
|
})
|