aboutsummaryrefslogtreecommitdiff
path: root/extension/src/Settings.ts
blob: a38680a7c564bacf62e289b42db8d882cff2e95b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
}