Restore singleton pdfCachingTransportFactory (#21194)

GitOrigin-RevId: 3c1d71ba4fdd07f0774534fbe3a99b2d47dfa962
This commit is contained in:
Alf Eaton 2024-10-17 14:29:13 +01:00 committed by Copybot
parent 3b354462a7
commit 620f31d6a6

View file

@ -18,6 +18,7 @@ export default class PDFJSWrapper {
public readonly viewer: PDFViewer public readonly viewer: PDFViewer
public readonly eventBus: EventBus public readonly eventBus: EventBus
private readonly linkService: PDFLinkService private readonly linkService: PDFLinkService
private readonly pdfCachingTransportFactory: any
// eslint-disable-next-line no-useless-constructor // eslint-disable-next-line no-useless-constructor
constructor(public container: HTMLDivElement) { constructor(public container: HTMLDivElement) {
@ -43,6 +44,8 @@ export default class PDFJSWrapper {
}) })
this.linkService.setViewer(this.viewer) this.linkService.setViewer(this.viewer)
this.pdfCachingTransportFactory = generatePdfCachingTransportFactory()
} }
// load a document from a URL // load a document from a URL
@ -64,7 +67,7 @@ export default class PDFJSWrapper {
} }
return new Promise<PDFJS.PDFDocumentProxy>((resolve, reject) => { return new Promise<PDFJS.PDFDocumentProxy>((resolve, reject) => {
const rangeTransport = generatePdfCachingTransportFactory()({ const rangeTransport = this.pdfCachingTransportFactory({
url, url,
pdfFile, pdfFile,
abortController, abortController,