Merge pull request #11607 from Snuffleupagus/app-initializedPromise
Add a `PDFViewerApplication.initializedPromise` property to allow (easier) tracking of when the default viewer has been initialized
This commit is contained in:
commit
e2b30e9e9c
13
web/app.js
13
web/app.js
@ -38,6 +38,7 @@ import {
|
|||||||
import { AppOptions, OptionKind } from "./app_options.js";
|
import { AppOptions, OptionKind } from "./app_options.js";
|
||||||
import {
|
import {
|
||||||
build,
|
build,
|
||||||
|
createPromiseCapability,
|
||||||
getDocument,
|
getDocument,
|
||||||
getFilenameFromUrl,
|
getFilenameFromUrl,
|
||||||
GlobalWorkerOptions,
|
GlobalWorkerOptions,
|
||||||
@ -128,7 +129,7 @@ class DefaultExternalServices {
|
|||||||
|
|
||||||
const PDFViewerApplication = {
|
const PDFViewerApplication = {
|
||||||
initialBookmark: document.location.hash.substring(1),
|
initialBookmark: document.location.hash.substring(1),
|
||||||
initialized: false,
|
_initializedCapability: createPromiseCapability(),
|
||||||
fellback: false,
|
fellback: false,
|
||||||
appConfig: null,
|
appConfig: null,
|
||||||
pdfDocument: null,
|
pdfDocument: null,
|
||||||
@ -215,7 +216,7 @@ const PDFViewerApplication = {
|
|||||||
this.eventBus.dispatch("localized", { source: this });
|
this.eventBus.dispatch("localized", { source: this });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.initialized = true;
|
this._initializedCapability.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -476,6 +477,14 @@ const PDFViewerApplication = {
|
|||||||
this.initialize(config).then(webViewerInitialized);
|
this.initialize(config).then(webViewerInitialized);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get initialized() {
|
||||||
|
return this._initializedCapability.settled;
|
||||||
|
},
|
||||||
|
|
||||||
|
get initializedPromise() {
|
||||||
|
return this._initializedCapability.promise;
|
||||||
|
},
|
||||||
|
|
||||||
zoomIn(ticks) {
|
zoomIn(ticks) {
|
||||||
if (this.pdfViewer.isInPresentationMode) {
|
if (this.pdfViewer.isInPresentationMode) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user