mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-31 01:58:11 +08:00
20 lines
426 B
JavaScript
20 lines
426 B
JavaScript
const settings = JSON.parse(window.localStorage.getItem("settings")) || {};
|
|
|
|
export function settings_get(key) {
|
|
if (settings[key] === undefined) {
|
|
return null;
|
|
}
|
|
return settings[key];
|
|
}
|
|
|
|
export function settings_put(key, value) {
|
|
settings[key] = value;
|
|
save(settings);
|
|
}
|
|
|
|
function save(d) {
|
|
setTimeout(() => {
|
|
window.localStorage.setItem("settings", JSON.stringify(d));
|
|
}, 500);
|
|
}
|