feat: 支持任务监控系统
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
type AvailabilityQuery,
|
||||
type CancelBookingInput,
|
||||
type CreateBookingInput,
|
||||
type CreateMonitorTaskInput,
|
||||
type TennisBookApi,
|
||||
type UpdateCourtSettingsInput
|
||||
} from '../shared/contracts'
|
||||
@@ -21,7 +22,20 @@ const api: TennisBookApi = {
|
||||
cancelBooking: (input: CancelBookingInput) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.cancelBooking, input),
|
||||
getPendingBooking: (courtId: string) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.getPendingBooking, courtId)
|
||||
ipcRenderer.invoke(IPC_CHANNELS.getPendingBooking, courtId),
|
||||
listMonitorTasks: () => ipcRenderer.invoke(IPC_CHANNELS.listMonitorTasks),
|
||||
createMonitorTask: (input: CreateMonitorTaskInput) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.createMonitorTask, input),
|
||||
setMonitorTaskEnabled: (taskId: string, enabled: boolean) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.setMonitorTaskEnabled, taskId, enabled),
|
||||
deleteMonitorTask: (taskId: string) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.deleteMonitorTask, taskId),
|
||||
takeMonitorAlerts: () => ipcRenderer.invoke(IPC_CHANNELS.takeMonitorAlerts),
|
||||
onMonitorAlert: (listener: () => void) => {
|
||||
const handler = () => listener()
|
||||
ipcRenderer.on(IPC_CHANNELS.monitorAlert, handler)
|
||||
return () => ipcRenderer.removeListener(IPC_CHANNELS.monitorAlert, handler)
|
||||
}
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('tennisBook', api)
|
||||
|
||||
Reference in New Issue
Block a user