Import Promise.allSettled from core-js (#7099)

GitOrigin-RevId: e7c1da844c3c7e8caec386b06f3b8393ea79529c
This commit is contained in:
Alf Eaton 2022-03-18 10:12:48 +00:00 committed by Copybot
parent a3a062b18b
commit 9d9bf8b9d0

View file

@ -1,5 +1,7 @@
// NOTE: using "legacy" build as main build requires webpack v5
// import PDFJS from 'pdfjs-dist/webpack'
import 'core-js/features/promise/all-settled' // polyfill for Promise.allSettled (used by pdf.js)
import * as PDFJS from 'pdfjs-dist/legacy/build/pdf'
import * as PDFJSViewer from 'pdfjs-dist/legacy/web/pdf_viewer'
import PDFJSWorker from 'pdfjs-dist/legacy/build/pdf.worker'
@ -11,11 +13,6 @@ if (typeof window !== 'undefined' && 'Worker' in window) {
PDFJS.GlobalWorkerOptions.workerPort = new PDFJSWorker()
}
// forces the method (required by pdf.js) to be polyfilled by webpack, since
// processing pdf.js by webpack/babel causes issues loading documents
// eslint-disable-next-line no-unused-expressions
Promise.allSettled
const params = new URLSearchParams(window.location.search)
const disableFontFace = params.get('disable-font-face') === 'true'
const cMapUrl = getMeta('ol-pdfCMapsPath')