refactor
This commit is contained in:
parent
c93141daed
commit
e21224067b
|
@ -0,0 +1,17 @@
|
|||
import {
|
||||
importURLSearchParams,
|
||||
importIntersectionObserver,
|
||||
importRequestIdleCallback,
|
||||
importIndexedDBGetAllShim,
|
||||
importDialogPolyfill
|
||||
} from './asyncModules'
|
||||
|
||||
export function loadPolyfills() {
|
||||
return Promise.all([
|
||||
typeof URLSearchParams === 'undefined' && importURLSearchParams(),
|
||||
typeof IntersectionObserver === 'undefined' && importIntersectionObserver(),
|
||||
typeof requestIdleCallback === 'undefined' && importRequestIdleCallback(),
|
||||
!IDBObjectStore.prototype.getAll && importIndexedDBGetAllShim(),
|
||||
typeof HTMLDialogElement === 'undefined' && importDialogPolyfill()
|
||||
])
|
||||
}
|
|
@ -1,23 +1,9 @@
|
|||
import { init } from 'sapper/runtime.js'
|
||||
import { offlineNotifiction } from '../routes/_utils/offlineNotification'
|
||||
import { serviceWorkerClient } from '../routes/_utils/serviceWorkerClient'
|
||||
import { loadPolyfills } from '../routes/_utils/loadPolyfills'
|
||||
|
||||
import {
|
||||
importURLSearchParams,
|
||||
importIntersectionObserver,
|
||||
importRequestIdleCallback,
|
||||
importIndexedDBGetAllShim,
|
||||
importDialogPolyfill
|
||||
} from '../routes/_utils/asyncModules'
|
||||
|
||||
// polyfills
|
||||
Promise.all([
|
||||
typeof URLSearchParams === 'undefined' && importURLSearchParams(),
|
||||
typeof IntersectionObserver === 'undefined' && importIntersectionObserver(),
|
||||
typeof requestIdleCallback === 'undefined' && importRequestIdleCallback(),
|
||||
!IDBObjectStore.prototype.getAll && importIndexedDBGetAllShim(),
|
||||
typeof HTMLDialogElement === 'undefined' && importDialogPolyfill()
|
||||
]).then(() => {
|
||||
loadPolyfills().then(() => {
|
||||
// `routes` is an array of route objects injected by Sapper
|
||||
init(document.querySelector('#sapper'), __routes__)
|
||||
})
|
Loading…
Reference in New Issue