2014-08-16 13:13:26 +02:00
|
|
|
define([], function() {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
get: function(key) {
|
|
|
|
|
return window.localStorage[key];
|
|
|
|
|
},
|
|
|
|
|
set: function(key, value) {
|
|
|
|
|
window.localStorage[key] = value;
|
|
|
|
|
},
|
2015-01-05 17:03:56 +01:00
|
|
|
getBool: function(key, def) {
|
|
|
|
|
if (def !== void 0 && !this.exists(key)) {
|
|
|
|
|
return def;
|
|
|
|
|
}
|
2015-11-24 07:29:52 +01:00
|
|
|
return window.localStorage[key] === 'true';
|
2014-08-16 13:13:26 +02:00
|
|
|
},
|
2015-01-05 17:03:56 +01:00
|
|
|
exists: function(key) {
|
|
|
|
|
return window.localStorage[key] !== void 0;
|
|
|
|
|
},
|
2014-08-16 13:13:26 +02:00
|
|
|
delete: function(key) {
|
|
|
|
|
window.localStorage.removeItem(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|