You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/04/20 14:49:38 UTC
[whimsy] branch master updated: switch to session storage for now
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 <ru...@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" <co...@whimsical.apache.org>'].
Re: [whimsy] branch master updated: switch to session storage for now
Posted by sebb <se...@gmail.com>.
On 20 April 2016 at 13:49, <ru...@apache.org> wrote:
> 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 <ru...@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')
Should that still be localStorage in the previous line?
> end
>
> --
> To stop receiving notification emails like this one, please contact
> ['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].