mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-17 12:56:41 +02:00
16 lines
374 B
TypeScript
16 lines
374 B
TypeScript
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)
|