aboutsummaryrefslogtreecommitdiff
path: root/extension/src/Settings.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/Settings.ts')
-rw-r--r--extension/src/Settings.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/extension/src/Settings.ts b/extension/src/Settings.ts
new file mode 100644
index 0000000..a38680a
--- /dev/null
+++ b/extension/src/Settings.ts
@@ -0,0 +1,31 @@
+import {getBrowser} from "./main.tsx";
+
+export interface ISettings {
+ sort: "from-bookmarks" | "alphabetical" | "frequency" | "recent"
+ foldersFirst: boolean
+ backgroundMode: "theme" | "color" | "image"
+ backgroundColor: string
+ backgroundImage: string
+ editMode: boolean
+ rootFolder: string | null
+}
+
+export let defaultSettings: ISettings = {
+ sort: "from-bookmarks",
+ foldersFirst: true,
+ backgroundMode: "theme",
+ backgroundColor: "#000000",
+ backgroundImage: "",
+ editMode: false,
+ rootFolder: '0',
+}
+
+export function loadSettings(): Promise<ISettings> {
+ // @ts-ignore
+ return getBrowser().storage.local.get(defaultSettings)
+}
+
+export function writeSettings(settings: ISettings) {
+ getBrowser().storage.local.set(settings);
+}
+