Files
planet/client/src/preload/recording-cursor.ts
T
linkong b3d2d9e9f1
ci / backend (push) Waiting to run
ci / frontend (push) Waiting to run
release: bump version to 0.81.0
2026-11-30 19:39:29 +08:00

18 lines
626 B
TypeScript

import { contextBridge, ipcRenderer } from 'electron'
import type { RecordingCursorPayload } from '../main/recording-core'
contextBridge.exposeInMainWorld('planetRecordingCursor', {
onUpdate: (callback: (payload: RecordingCursorPayload) => void) => {
const listener = (_event: Electron.IpcRendererEvent, payload: unknown) => {
if (payload && typeof payload === 'object') {
callback(payload as RecordingCursorPayload)
}
}
ipcRenderer.on('planet:recording-cursor-update', listener)
return () => {
ipcRenderer.removeListener('planet:recording-cursor-update', listener)
}
},
})