@cimo/jsmvcfw
Version:
Javascript mvc framework. Light, fast and secure.
17 lines • 621 B
JavaScript
import { getAppLabel } from "./JsMvcFw.js";
export const writeStorage = (tag, value) => {
const encodedData = window.btoa(encodeURIComponent(JSON.stringify(value)));
localStorage.setItem(`${getAppLabel()}_${tag}`, encodedData);
};
export const readStorage = (tag) => {
let result;
const storage = localStorage.getItem(`${getAppLabel()}_${tag}`);
if (storage) {
result = JSON.parse(decodeURIComponent(window.atob(storage)));
}
return result;
};
export const deleteStorage = (tag) => {
localStorage.removeItem(`${getAppLabel()}_${tag}`);
};
//# sourceMappingURL=JsMvcFwStorage.js.map