Merge pull request #12992 from Snuffleupagus/scripting-compact-fallback-events
Use a more compact format for the fallback EventBus-listeners in `PDFViewerApplication_initializeJavaScript`
This commit is contained in:
commit
b9beca90c7
16
web/app.js
16
web/app.js
@ -1479,13 +1479,7 @@ const PDFViewerApplication = {
|
|||||||
// It should be *extremely* rare for metadata to not have been resolved
|
// It should be *extremely* rare for metadata to not have been resolved
|
||||||
// when this code runs, but ensure that we handle that case here.
|
// when this code runs, but ensure that we handle that case here.
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
this.eventBus._on(
|
this.eventBus._on("metadataloaded", resolve, { once: true });
|
||||||
"metadataloaded",
|
|
||||||
evt => {
|
|
||||||
resolve();
|
|
||||||
},
|
|
||||||
{ once: true }
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
return; // The document was closed while the metadata resolved.
|
return; // The document was closed while the metadata resolved.
|
||||||
@ -1498,13 +1492,7 @@ const PDFViewerApplication = {
|
|||||||
// Hence we'll simply have to trust that the `contentLength` (as provided
|
// Hence we'll simply have to trust that the `contentLength` (as provided
|
||||||
// by the server), when it exists, is accurate enough here.
|
// by the server), when it exists, is accurate enough here.
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
this.eventBus._on(
|
this.eventBus._on("documentloaded", resolve, { once: true });
|
||||||
"documentloaded",
|
|
||||||
evt => {
|
|
||||||
resolve();
|
|
||||||
},
|
|
||||||
{ once: true }
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
return; // The document was closed while the downloadInfo resolved.
|
return; // The document was closed while the downloadInfo resolved.
|
||||||
|
@ -740,8 +740,8 @@ class BaseViewer {
|
|||||||
*/
|
*/
|
||||||
get _pageWidthScaleFactor() {
|
get _pageWidthScaleFactor() {
|
||||||
if (
|
if (
|
||||||
this.spreadMode !== SpreadMode.NONE &&
|
this._spreadMode !== SpreadMode.NONE &&
|
||||||
this.scrollMode !== ScrollMode.HORIZONTAL &&
|
this._scrollMode !== ScrollMode.HORIZONTAL &&
|
||||||
!this.isInPresentationMode
|
!this.isInPresentationMode
|
||||||
) {
|
) {
|
||||||
return 2;
|
return 2;
|
||||||
@ -1642,7 +1642,7 @@ class BaseViewer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeScriptingEvents() {
|
async initializeScriptingEvents() {
|
||||||
if (!this.enableScripting || this._pageOpenPendingSet) {
|
if (!this.enableScripting || this._pageOpenPendingSet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user