mirror of https://github.com/pixelfed/pixelfed
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.
33 lines
506 B
JavaScript
33 lines
506 B
JavaScript
window.ls = {};
|
|
|
|
window.ls.get = function(key) {
|
|
return JSON.parse(localStorage.getItem(key));
|
|
}
|
|
|
|
|
|
window.ls.set = function(key, val) {
|
|
try {
|
|
localStorage.setItem(key, JSON.stringify(val));
|
|
return true;
|
|
} catch(e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
window.ls.del = function(key) {
|
|
try {
|
|
localStorage.removeItem(key);
|
|
return true;
|
|
} catch(e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
window.ls.clear = function() {
|
|
try {
|
|
localStorage.clear();
|
|
return true;
|
|
} catch(e) {
|
|
return false;
|
|
}
|
|
} |