Files
meshtastic-web/src/core/services/messaging/db.ts
T
2025-03-24 15:37:51 -04:00

14 lines
432 B
TypeScript

import { StateStorage } from "zustand/middleware";
import { get, set, del } from "idb-keyval";
export const zustandIDBStorage: StateStorage = {
getItem: async (name: string): Promise<string | null> => {
return (await get(name)) || null;
},
setItem: async (name: string, value: string): Promise<void> => {
await set(name, value);
},
removeItem: async (name: string): Promise<void> => {
await del(name);
},
};