trying with the store and such

This commit is contained in:
talksik
2022-03-17 20:13:49 -04:00
parent 453121c987
commit 34fe8e0c29
21 changed files with 478 additions and 35758 deletions
+29
View File
@@ -0,0 +1,29 @@
import { contextBridge, ipcRenderer } from "electron";
import Channels from "./constants";
const electronAPI = {
auth: {
initiateLogin() {
ipcRenderer.send(Channels.ACTIVATE_LOG_IN);
},
receiveTokens(callback: any) {
ipcRenderer.on(Channels.AUTH_TOKENS, callback);
},
},
batteryApi: {},
fileApi: {},
store: {
get(val: string) {
return ipcRenderer.sendSync("electron-store-get", val);
},
set(property: string, val: any) {
ipcRenderer.send("electron-store-set", property, val);
},
// Other method you want to add like has(), reset(), etc.
},
};
contextBridge.exposeInMainWorld("electronAPI", electronAPI);
export default electronAPI;