[Pkg-javascript-commits] [pdf.js] 32/119: Small refactoring of the code that calls |PDFViewerApplication.setInitialView|
David Prévot
taffit at moszumanska.debian.org
Wed May 13 21:27:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit e5c48196019438eda0ce1dc636d55dde67b0ccb0
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Tue Mar 31 18:17:56 2015 +0200
Small refactoring of the code that calls |PDFViewerApplication.setInitialView|
This is a minor cleanup, to avoid an unnecessary `Promise.all` and to simplify catching |ViewHistory| errors.
---
web/viewer.js | 52 ++++++++++++++++++++++++----------------------------
1 file changed, 24 insertions(+), 28 deletions(-)
diff --git a/web/viewer.js b/web/viewer.js
index 5b11a14..ccf940f 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -886,38 +886,34 @@ var PDFViewerApplication = {
}
PDFHistory.initialize(self.documentFingerprint, self);
}
- });
- var storePromise = store.initializedPromise;
- Promise.all([firstPagePromise, storePromise]).then(function resolved() {
- var storedHash = null;
- if (self.preferenceShowPreviousViewOnLoad &&
- store.get('exists', false)) {
- var pageNum = store.get('page', '1');
- var zoom = self.preferenceDefaultZoomValue ||
- store.get('zoom', self.pdfViewer.currentScale);
- var left = store.get('scrollLeft', '0');
- var top = store.get('scrollTop', '0');
-
- storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' +
- left + ',' + top;
- } else if (self.preferenceDefaultZoomValue) {
- storedHash = 'page=1&zoom=' + self.preferenceDefaultZoomValue;
- }
- self.setInitialView(storedHash, scale);
+ store.initializedPromise.then(function resolved() {
+ var storedHash = null;
+ if (self.preferenceShowPreviousViewOnLoad &&
+ store.get('exists', false)) {
+ var pageNum = store.get('page', '1');
+ var zoom = self.preferenceDefaultZoomValue ||
+ store.get('zoom', self.pdfViewer.currentScale);
+ var left = store.get('scrollLeft', '0');
+ var top = store.get('scrollTop', '0');
+
+ storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' +
+ left + ',' + top;
+ } else if (self.preferenceDefaultZoomValue) {
+ storedHash = 'page=1&zoom=' + self.preferenceDefaultZoomValue;
+ }
+ self.setInitialView(storedHash, scale);
- // Make all navigation keys work on document load,
- // unless the viewer is embedded in a web page.
- if (!self.isViewerEmbedded) {
- self.pdfViewer.focus();
+ // Make all navigation keys work on document load,
+ // unless the viewer is embedded in a web page.
+ if (!self.isViewerEmbedded) {
+ self.pdfViewer.focus();
//#if (FIREFOX || MOZCENTRAL)
-// self.pdfViewer.blur();
+// self.pdfViewer.blur();
//#endif
- }
- }, function rejected(reason) {
- console.error(reason);
-
- firstPagePromise.then(function () {
+ }
+ }, function rejected(reason) {
+ console.error(reason);
self.setInitialView(null, scale);
});
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list