mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
27 lines
534 B
JavaScript
27 lines
534 B
JavaScript
|
|
||
|
function localSet(k, v) {
|
||
|
try {
|
||
|
localStorage.setItem(k, v);
|
||
|
} catch (e) {
|
||
|
console.warn(`Failed to save ${k} to localStorage: ${e}`);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function localGet(k, def) {
|
||
|
try {
|
||
|
return localStorage.getItem(k);
|
||
|
} catch (e) {
|
||
|
console.warn(`Failed to load ${k} from localStorage: ${e}`);
|
||
|
}
|
||
|
|
||
|
return def;
|
||
|
}
|
||
|
|
||
|
function localRemove(k) {
|
||
|
try {
|
||
|
return localStorage.removeItem(k);
|
||
|
} catch (e) {
|
||
|
console.warn(`Failed to remove ${k} from localStorage: ${e}`);
|
||
|
}
|
||
|
}
|