Files
partey_workadventure/desktop/src/sidebar/preload.ts
T
2022-02-18 10:26:21 +01:00

14 lines
519 B
TypeScript

import { contextBridge, ipcRenderer } from "electron";
import type { WorkAdventureSidebarApi } from "./types";
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);