mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-24 14:03:16 +00:00
33 lines
No EOL
506 B
JavaScript
Vendored
33 lines
No EOL
506 B
JavaScript
Vendored
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;
|
|
}
|
|
} |