feat: add support for client-side server to tauri module (#501)
This commit is contained in:
parent
2b5051e123
commit
9800697670
8 changed files with 143 additions and 2 deletions
27
modules/tauri/runtime/storage.ts
Normal file
27
modules/tauri/runtime/storage.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
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 const useStorage = () => storage
|
Loading…
Add table
Add a link
Reference in a new issue