grafana/public/app/components/store.js

27 lines
558 B
JavaScript
Raw Normal View History

2014-08-16 06:13:26 -05:00
define([], function() {
'use strict';
return {
get: function(key) {
return window.localStorage[key];
},
set: function(key, value) {
window.localStorage[key] = value;
},
getBool: function(key, def) {
if (def !== void 0 && !this.exists(key)) {
return def;
}
2014-08-16 06:13:26 -05:00
return window.localStorage[key] === 'true' ? true : false;
},
exists: function(key) {
return window.localStorage[key] !== void 0;
},
2014-08-16 06:13:26 -05:00
delete: function(key) {
window.localStorage.removeItem(key);
}
};
});