Add typed ipc
This commit is contained in:
29
src/preload/index.d.ts
vendored
29
src/preload/index.d.ts
vendored
@@ -1,8 +1,31 @@
|
||||
import { ElectronAPI } from '@electron-toolkit/preload'
|
||||
export interface INanoDevicesAPI {
|
||||
list_devices(): Promise<string[]>
|
||||
connect(deviceid: string): Promise<string>
|
||||
disconnect(deviceid: string): Promise<string>
|
||||
on_event(
|
||||
eventid_filter: string,
|
||||
callback: (eventid: string, deviceid: string, data: any) => void
|
||||
): void
|
||||
send(deviceid: string, jsonstr: string): Promise<void>
|
||||
}
|
||||
|
||||
export interface IElectronAPI {
|
||||
platform: NodeJS.Platform
|
||||
isDevelopment: boolean
|
||||
minimizeWindow: () => void
|
||||
toggleMaximizeWindow: () => void
|
||||
closeWindow: () => void
|
||||
openExternal: (url: string) => void
|
||||
onMaximized: (callback: () => void) => void
|
||||
onUnmaximized: (callback: () => void) => void
|
||||
onMenu: (callback: (key: string) => void) => void
|
||||
openDevTools: () => void
|
||||
reload: () => void
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
electron: ElectronAPI
|
||||
api: unknown
|
||||
nanoDevicesAPI: INanoDevicesAPI
|
||||
electronAPI: IElectronAPI
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user