[Pkg-javascript-commits] [pdf.js] 22/210: Add support for setting multiple values at once in ViewHistory

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:20:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch upstream
in repository pdf.js.

commit 69eafaa58fa6d6440bf43066c9476567920150ea
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Fri Apr 25 20:28:26 2014 +0200

    Add support for setting multiple values at once in ViewHistory
---
 web/view_history.js | 10 ++++++++++
 web/viewer.js       | 15 ++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/web/view_history.js b/web/view_history.js
index ec81396..5e5f81e 100644
--- a/web/view_history.js
+++ b/web/view_history.js
@@ -113,6 +113,16 @@ var ViewHistory = (function ViewHistoryClosure() {
       this._writeToStorage();
     },
 
+    setMultiple: function ViewHistory_setMultiple(properties) {
+      if (!this.isInitializedPromiseResolved) {
+        return;
+      }
+      for (var name in properties) {
+        this.file[name] = properties[name];
+      }
+      this._writeToStorage();
+    },
+
     get: function ViewHistory_get(name, defaultValue) {
       if (!this.isInitializedPromiseResolved) {
         return defaultValue;
diff --git a/web/viewer.js b/web/viewer.js
index c44ca8d..3cbe628 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1970,13 +1970,14 @@ function updateViewarea() {
     PDFView.currentPosition = { page: pageNumber, left: intLeft, top: intTop };
   }
 
-  var store = PDFView.store;
-  store.initializedPromise.then(function() {
-    store.set('exists', true);
-    store.set('page', pageNumber);
-    store.set('zoom', normalizedScaleValue);
-    store.set('scrollLeft', intLeft);
-    store.set('scrollTop', intTop);
+  PDFView.store.initializedPromise.then(function() {
+    PDFView.store.setMultiple({
+      'exists': true,
+      'page': pageNumber,
+      'zoom': normalizedScaleValue,
+      'scrollLeft': intLeft,
+      'scrollTop': intTop
+    });
   });
   var href = PDFView.getAnchorUrl(pdfOpenParams);
   document.getElementById('viewBookmark').href = href;

-- 
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