extract types for ipc

This commit is contained in:
Anton Bracke
2022-02-18 10:26:21 +01:00
parent c891fcb1bd
commit a86bf32ee2
5 changed files with 30 additions and 10 deletions
+5 -2
View File
@@ -1,10 +1,13 @@
import { contextBridge, ipcRenderer } from "electron";
import type { WorkAdventureSidebarApi } from "./types";
contextBridge.exposeInMainWorld("WorkAdventureDesktopApi", {
const api: WorkAdventureSidebarApi = {
desktop: true,
getServers: () => ipcRenderer.invoke("sidebar:getServers"),
selectServer: (serverId: string) =>
ipcRenderer.invoke("sidebar:selectServer", serverId),
addServer: (serverName: string, serverUrl: string) =>
ipcRenderer.invoke("sidebar:addServer", serverName, serverUrl),
});
};
contextBridge.exposeInMainWorld("WorkAdventureDesktopApi", api);