summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop-electron/src/main/store.ts
blob: cf2d25b110ca41fc245024eab20e87391912e2c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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, fileExtension: "" })
  cache.set(name, next)
  return next
}

export const store = getStore(SETTINGS_STORE)