1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-21 03:43:55 +00:00
Files
jslib/electron/src/services/electronRendererStorage.service.ts
2021-12-16 13:36:21 +01:00

35 lines
770 B
TypeScript

import { ipcRenderer } from "electron";
import { StorageService } from "jslib-common/abstractions/storage.service";
export class ElectronRendererStorageService implements StorageService {
get<T>(key: string): Promise<T> {
return ipcRenderer.invoke("storageService", {
action: "get",
key: key,
});
}
has(key: string): Promise<boolean> {
return ipcRenderer.invoke("storageService", {
action: "has",
key: key,
});
}
save(key: string, obj: any): Promise<any> {
return ipcRenderer.invoke("storageService", {
action: "save",
key: key,
obj: obj,
});
}
remove(key: string): Promise<any> {
return ipcRenderer.invoke("storageService", {
action: "remove",
key: key,
});
}
}