1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-20 11:16:36 +02:00
ttrss/js/ArticleCache.js
Andrew Dolgov 84affc7b1d rework dojo singleton modules to better work with phpstorm completion (ugh) - declare() is not needed there anyway
remove event.observe from login form (not needed)
load pluginhost via amd
2018-12-03 09:33:44 +03:00

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;
});