diff options
Diffstat (limited to 'packages/desktop-electron/src/main/store.ts')
| -rw-r--r-- | packages/desktop-electron/src/main/store.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/desktop-electron/src/main/store.ts b/packages/desktop-electron/src/main/store.ts new file mode 100644 index 000000000..fa1c5682e --- /dev/null +++ b/packages/desktop-electron/src/main/store.ts @@ -0,0 +1,15 @@ +import Store from "electron-store" + +import { SETTINGS_STORE } from "./constants" + +const cache = new Map<string, Store>() + +export function getStore(name = SETTINGS_STORE) { + const cached = cache.get(name) + if (cached) return cached + const next = new Store({ name }) + cache.set(name, next) + return next +} + +export const store = getStore(SETTINGS_STORE) |
