whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: switch to session storage for now
Date Wed, 20 Apr 2016 12:49:38 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  739f202   switch to session storage for now
739f202 is described below

commit 739f202aa2abf6a2bec321da714de41f96d8fe06
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Wed Apr 20 08:49:22 2016 -0400

    switch to session storage for now
---
 www/board/agenda/views/models/jsonstorage.js.rb | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/www/board/agenda/views/models/jsonstorage.js.rb b/www/board/agenda/views/models/jsonstorage.js.rb
index 8ef5b56..e85b6df 100644
--- a/www/board/agenda/views/models/jsonstorage.js.rb
+++ b/www/board/agenda/views/models/jsonstorage.js.rb
@@ -1,9 +1,9 @@
 #
-# Simplify access to localStorage for JSON objects
+# Simplify access to sessionStorage for JSON objects
 #
 
 class JSONStorage
-  # determine localStorage variable prefix based on url up to the date
+  # determine sessionStorage variable prefix based on url up to the date
   def self.prefix
     return @@prefix if @@prefix
 
@@ -21,13 +21,16 @@ class JSONStorage
   # store an item, converting it to JSON
   def self.put(name, value)
     name = JSONStorage.prefix + '-' + name
-    localStorage.setItem(name, JSON.stringify(value))
+    begin
+      sessionStorage.setItem(name, JSON.stringify(value))
+    rescue => e
+    end
     return value
   end
 
   # retrieve an item, converting it back to an object
   def self.get(name)
-    if defined? localStorage
+    if defined? sessionStorage
       name = JSONStorage.prefix + '-' + name
       return JSON.parse(localStorage.getItem(name) || 'null')
     end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message