2018-01-27 16:31:26 -08:00
|
|
|
import {
|
2020-06-28 23:12:14 -07:00
|
|
|
importArrayFlat,
|
2018-12-15 02:06:12 -08:00
|
|
|
importCustomElementsPolyfill,
|
2018-12-13 22:55:04 -08:00
|
|
|
importIndexedDBGetAllShim,
|
2018-01-27 16:31:26 -08:00
|
|
|
importIntersectionObserver,
|
2019-09-20 23:17:52 -07:00
|
|
|
importIntl,
|
2020-06-28 23:12:14 -07:00
|
|
|
importRequestIdleCallback,
|
|
|
|
|
importShadowDomPolyfill
|
2018-12-15 17:13:46 -08:00
|
|
|
} from './asyncPolyfills'
|
2018-01-27 16:31:26 -08:00
|
|
|
|
2018-02-08 22:29:29 -08:00
|
|
|
export function loadPolyfills () {
|
2018-01-27 16:31:26 -08:00
|
|
|
return Promise.all([
|
|
|
|
|
typeof requestIdleCallback === 'undefined' && importRequestIdleCallback(),
|
2020-06-28 23:12:14 -07:00
|
|
|
// these legacy polyfills should be kept in sync with webpack/shared.config.js
|
|
|
|
|
process.env.LEGACY && !Array.prototype.flat && importArrayFlat(),
|
|
|
|
|
process.env.LEGACY && !IDBObjectStore.prototype.getAll && importIndexedDBGetAllShim(),
|
|
|
|
|
process.env.LEGACY && typeof IntersectionObserver === 'undefined' && importIntersectionObserver(),
|
|
|
|
|
process.env.LEGACY && typeof Intl === 'undefined' && importIntl(),
|
|
|
|
|
process.env.LEGACY && typeof customElements === 'undefined' && importCustomElementsPolyfill(),
|
|
|
|
|
process.env.LEGACY && !HTMLElement.prototype.attachShadow && importShadowDomPolyfill()
|
2018-01-27 16:31:26 -08:00
|
|
|
])
|
2018-02-08 22:29:29 -08:00
|
|
|
}
|