1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-15 05:19:58 +00:00
elk/modules/tauri/runtime/storage.ts
renovate[bot] 320ddc0e28
chore(deps): update dependency @antfu/eslint-config to v3 (#2984)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>
2024-09-30 08:11:56 +00:00

30 lines
582 B
TypeScript

import { Store } from 'tauri-plugin-store-api'
import { createStorage } from 'unstorage'
const store = new Store('.servers.dat')
const storage = createStorage()
storage.mount('servers', {
getKeys() {
return store.keys()
},
async removeItem(key: string) {
await store.delete(key)
},
clear() {
return store.clear()
},
hasItem(key: string) {
return store.has(key)
},
setItem(key: string, value: any) {
return store.set(key, value)
},
getItem(key: string) {
return store.get(key)
},
})
export function useStorage() {
return storage
}