2017-04-22 14:03:00 +01:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
module.exports = {
|
2018-03-04 19:59:16 -05:00
|
|
|
set(key, value) {
|
2017-04-22 14:03:00 +01:00
|
|
|
try {
|
|
|
|
window.localStorage.setItem(key, value);
|
|
|
|
} catch (e) {
|
|
|
|
// Do nothing. If we end up here, web storage quota exceeded, or user is
|
|
|
|
// in Safari's private browsing where localStorage's setItem is not
|
|
|
|
// available. See http://stackoverflow.com/q/14555347/1935861.
|
|
|
|
}
|
|
|
|
},
|
2018-03-04 19:59:16 -05:00
|
|
|
get(key) {
|
2017-04-22 14:03:00 +01:00
|
|
|
return window.localStorage.getItem(key);
|
|
|
|
},
|
2018-03-20 00:52:58 -04:00
|
|
|
remove(key) {
|
|
|
|
window.localStorage.removeItem(key);
|
|
|
|
},
|
|
|
|
clear() {
|
|
|
|
window.localStorage.clear();
|
2017-11-15 01:35:15 -05:00
|
|
|
},
|
2017-04-22 14:03:00 +01:00
|
|
|
};
|