diff --git a/web/app.js b/web/app.js index c8e015706..1610f6249 100644 --- a/web/app.js +++ b/web/app.js @@ -38,6 +38,7 @@ import { import { AppOptions, OptionKind } from "./app_options.js"; import { build, + createPromiseCapability, getDocument, getFilenameFromUrl, GlobalWorkerOptions, @@ -128,7 +129,7 @@ class DefaultExternalServices { const PDFViewerApplication = { initialBookmark: document.location.hash.substring(1), - initialized: false, + _initializedCapability: createPromiseCapability(), fellback: false, appConfig: null, pdfDocument: null, @@ -215,7 +216,7 @@ const PDFViewerApplication = { this.eventBus.dispatch("localized", { source: this }); }); - this.initialized = true; + this._initializedCapability.resolve(); }, /** @@ -476,6 +477,14 @@ const PDFViewerApplication = { this.initialize(config).then(webViewerInitialized); }, + get initialized() { + return this._initializedCapability.settled; + }, + + get initializedPromise() { + return this._initializedCapability.promise; + }, + zoomIn(ticks) { if (this.pdfViewer.isInPresentationMode) { return;