pinafore/src/routes/_utils/loadPolyfills.js

18 wiersze
610 B
JavaScript
Czysty Zwykły widok Historia

2018-01-28 00:31:26 +00:00
import {
importCustomElementsPolyfill,
importIndexedDBGetAllShim,
2018-01-28 00:31:26 +00:00
importIntersectionObserver,
importIntl,
importRequestIdleCallback
} from './asyncPolyfills'
2018-01-28 00:31:26 +00:00
2018-02-09 06:29:29 +00:00
export function loadPolyfills () {
2018-01-28 00:31:26 +00:00
return Promise.all([
typeof IntersectionObserver === 'undefined' && importIntersectionObserver(),
typeof requestIdleCallback === 'undefined' && importRequestIdleCallback(),
!IDBObjectStore.prototype.getAll && importIndexedDBGetAllShim(),
typeof customElements === 'undefined' && importCustomElementsPolyfill(),
process.env.LEGACY && typeof Intl === 'undefined' && importIntl()
2018-01-28 00:31:26 +00:00
])
2018-02-09 06:29:29 +00:00
}