From 1fd43a87db911796cce5928700257971cb6b24f1 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Sun, 13 Apr 2014 21:07:36 -0500 Subject: [PATCH] Changes 'documentload' event behavior. --- web/viewer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/viewer.js b/web/viewer.js index cf0390472..9ecfc0d19 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -913,7 +913,7 @@ var PDFView = { DocumentProperties.resolveDataAvailable(); - pdfDocument.getDownloadInfo().then(function() { + var downloadedPromise = pdfDocument.getDownloadInfo().then(function() { self.downloadComplete = true; PDFView.loadingBar.hide(); var outerContainer = document.getElementById('outerContainer'); @@ -988,9 +988,11 @@ var PDFView = { } }); - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('documentload', true, true, {}); - window.dispatchEvent(event); + downloadedPromise.then(function () { + var event = document.createEvent('CustomEvent'); + event.initCustomEvent('documentload', true, true, {}); + window.dispatchEvent(event); + }); PDFView.loadingBar.setWidth(container);