diff options
Diffstat (limited to 'js/ArticleCache.js')
-rw-r--r-- | js/ArticleCache.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/js/ArticleCache.js b/js/ArticleCache.js index a4e8e091f..ce34d00d9 100644 --- a/js/ArticleCache.js +++ b/js/ArticleCache.js @@ -1,9 +1,9 @@ 'use strict' /* global __, ngettext */ define(["dojo/_base/declare"], function (declare) { - return declare("fox.ArticleCache", null, { + ArticleCache = { has_storage: 'sessionStorage' in window && window['sessionStorage'] !== null, - set: function(id, obj) { + set: function (id, obj) { if (this.has_storage) try { sessionStorage["article:" + id] = obj; @@ -11,17 +11,19 @@ define(["dojo/_base/declare"], function (declare) { sessionStorage.clear(); } }, - get: function(id) { + get: function (id) { if (this.has_storage) return sessionStorage["article:" + id]; }, - clear: function() { + clear: function () { if (this.has_storage) sessionStorage.clear(); }, - del: function(id) { + del: function (id) { if (this.has_storage) sessionStorage.removeItem("article:" + id); }, - }); + } + + return ArticleCache; }); |