You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tt-rss/js/ArticleCache.js

30 lines
663 B
JavaScript

'use strict'
/* global __, ngettext */
define(["dojo/_base/declare"], function (declare) {
ArticleCache = {
has_storage: 'sessionStorage' in window && window['sessionStorage'] !== null,
set: function (id, obj) {
if (this.has_storage)
try {
sessionStorage["article:" + id] = obj;
} catch (e) {
sessionStorage.clear();
}
},
get: function (id) {
if (this.has_storage)
return sessionStorage["article:" + id];
},
clear: function () {
if (this.has_storage)
sessionStorage.clear();
},
del: function (id) {
if (this.has_storage)
sessionStorage.removeItem("article:" + id);
},
}
return ArticleCache;
});