Archived
17 lines
842 B
TypeScript
17 lines
842 B
TypeScript
// See the Electron documentation for details on how to use preload scripts:
|
|
// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts
|
|
|
|
import { contextBridge, ipcRenderer } from "electron";
|
|
import { UIStatus } from "./types";
|
|
|
|
contextBridge.exposeInMainWorld('vynte', {
|
|
getStatus: () => ipcRenderer.invoke('status:get'),
|
|
refresh: () => ipcRenderer.invoke('status:refresh'),
|
|
connect: () => ipcRenderer.invoke('vpn:connect'),
|
|
disconnect: () => ipcRenderer.invoke('vpn:disconnect'),
|
|
logout: () => ipcRenderer.invoke('vpn:logout'),
|
|
toggleAuto: () => ipcRenderer.invoke('auto:toggle'),
|
|
quit: () => ipcRenderer.invoke('app:quit'),
|
|
openGateway: () => ipcRenderer.invoke('external:openGateway'),
|
|
onStatus: (callback: (status: UIStatus) => void) => ipcRenderer.on('status', (_, status) => callback(status))
|
|
}) |