From d076a210a1d3415852dd1e9d8746b0671eefbaf5 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 12 Feb 2025 23:08:11 +0200 Subject: [PATCH] Bring f-localStorage back --- public/scripts/f-localStorage.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 public/scripts/f-localStorage.js diff --git a/public/scripts/f-localStorage.js b/public/scripts/f-localStorage.js new file mode 100644 index 000000000..adcb3af4e --- /dev/null +++ b/public/scripts/f-localStorage.js @@ -0,0 +1,27 @@ +////////////////// LOCAL STORAGE HANDLING ///////////////////// + +export function SaveLocal(target, val) { + localStorage.setItem(target, val); + console.debug('SaveLocal -- ' + target + ' : ' + val); +} +export function LoadLocal(target) { + console.debug('LoadLocal -- ' + target); + return localStorage.getItem(target); + +} +export function LoadLocalBool(target) { + let result = localStorage.getItem(target) === 'true'; + return result; +} +export function CheckLocal() { + console.log('----------local storage---------'); + var i; + for (i = 0; i < localStorage.length; i++) { + console.log(localStorage.key(i) + ' : ' + localStorage.getItem(localStorage.key(i))); + } + console.log('------------------------------'); +} + +export function ClearLocal() { localStorage.clear(); console.log('Removed All Local Storage'); } + +/////////////////////////////////////////////////////////////////////////