From 93f274e1abe502235f11141649c188e5df6f3ce8 Mon Sep 17 00:00:00 2001 From: Aj - Thomas Date: Wed, 27 Apr 2022 03:12:33 +0200 Subject: [PATCH] Add config loader tools --- tools/config.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tools/config.ts diff --git a/tools/config.ts b/tools/config.ts new file mode 100644 index 000000000..3e8244e51 --- /dev/null +++ b/tools/config.ts @@ -0,0 +1,16 @@ +export function loadConfig(path: string): Config | null { + const item = localStorage.getItem(path); + if (!item) { + return null; + } + + try { + return JSON.parse(item) as Config; + } catch (e) { + return null; + } +} + +export interface Config { + searchBar: boolean, +} \ No newline at end of file