mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-05 08:29:57 +00:00
3c43a1cdd1
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
30 lines
582 B
TypeScript
30 lines
582 B
TypeScript
import { createStorage } from 'unstorage'
|
|
import { Store } from 'tauri-plugin-store-api'
|
|
|
|
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
|
|
}
|