1
0
mirror of https://github.com/nolanlawson/pinafore synced 2025-02-07 23:18:41 +01:00

19 lines
631 B
JavaScript
Raw Normal View History

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