[Pkg-javascript-commits] [pdf.js] 21/210: Add writeToStorage method to 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 48399a3ec7bb9762c28027d4993638908f3e781a
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Fri Apr 25 20:13:17 2014 +0200

    Add writeToStorage method to ViewHistory
---
 web/view_history.js | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/web/view_history.js b/web/view_history.js
index f785631..ec81396 100644
--- a/web/view_history.js
+++ b/web/view_history.js
@@ -86,30 +86,33 @@ var ViewHistory = (function ViewHistoryClosure() {
       this.database = database;
     },
 
-    set: function ViewHistory_set(name, val) {
-      if (!this.isInitializedPromiseResolved) {
-        return;
-      }
-      var file = this.file;
-      file[name] = val;
-      var database = JSON.stringify(this.database);
+    _writeToStorage: function ViewHistory_writeToStorage() {
+      var databaseStr = JSON.stringify(this.database);
 
 //#if B2G
-//    asyncStorage.setItem('database', database);
+//    asyncStorage.setItem('database', databaseStr);
 //#endif
 
 //#if FIREFOX || MOZCENTRAL
 //    try {
 //      // See comment in try-catch block above.
-//      sessionStorage.setItem('pdfjsHistory', database);
+//      sessionStorage.setItem('pdfjsHistory', databaseStr);
 //    } catch (ex) {}
 //#endif
 
 //#if !(FIREFOX || MOZCENTRAL || B2G)
-      localStorage.setItem('database', database);
+      localStorage.setItem('database', databaseStr);
 //#endif
     },
 
+    set: function ViewHistory_set(name, val) {
+      if (!this.isInitializedPromiseResolved) {
+        return;
+      }
+      this.file[name] = val;
+      this._writeToStorage();
+    },
+
     get: function ViewHistory_get(name, defaultValue) {
       if (!this.isInitializedPromiseResolved) {
         return defaultValue;

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