Limit some PDFRenderingQueue-related code to the GENERIC viewer

Given that this functionality is only relevant in third-party use-cases, for example the viewer-components, we can avoid needlessly including it in e.g. the MOZCENTRAL build.
This commit is contained in:
Jonas Jenwald 2023-05-30 16:48:04 +02:00
parent 071e6bc7e7
commit e8c727742c
2 changed files with 10 additions and 8 deletions

View File

@ -36,6 +36,12 @@ class PDFRenderingQueue {
this.idleTimeout = null;
this.printing = false;
this.isThumbnailViewEnabled = false;
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
Object.defineProperty(this, "hasViewer", {
value: () => !!this.pdfViewer,
});
}
}
/**
@ -60,13 +66,6 @@ class PDFRenderingQueue {
return this.highestPriorityPage === view.renderingId;
}
/**
* @returns {boolean}
*/
hasViewer() {
return !!this.pdfViewer;
}
/**
* @param {Object} currentlyVisiblePages
*/

View File

@ -301,7 +301,10 @@ class PDFViewer {
}
this.defaultRenderingQueue = !options.renderingQueue;
if (this.defaultRenderingQueue) {
if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
this.defaultRenderingQueue
) {
// Custom rendering queue is not specified, using default one
this.renderingQueue = new PDFRenderingQueue();
this.renderingQueue.setViewer(this);