This commit is contained in:
2026-10-17 19:29:49 +07:00
parent dc0d82d88a
commit a386f3d9e5
14 changed files with 1852 additions and 421 deletions
+4 -2
View File
@@ -1,9 +1,9 @@
import { contextBridge, ipcRenderer } from 'electron'
import type { Command, State } from '../src/types/screen.js'
import type { Command, Report, State } from '../src/types/screen.js'
contextBridge.exposeInMainWorld('screenBridge', {
command: (command: Command) => ipcRenderer.invoke('command', command),
report: (report: unknown) => ipcRenderer.send('report', report),
report: (report: Report) => ipcRenderer.send('report', report),
state: () => ipcRenderer.invoke('state'),
subscribe: (listener: (state: State) => void) => {
const handler = (_event: Electron.IpcRendererEvent, state: State) => listener(state)
@@ -12,4 +12,6 @@ contextBridge.exposeInMainWorld('screenBridge', {
},
host: () => ipcRenderer.invoke('host'),
show: (id: number) => ipcRenderer.invoke('show', id),
packages: () => ipcRenderer.invoke('packages'),
selectPackage: (key: string | null) => ipcRenderer.invoke('select-package', key),
})