MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / sendInputEvent

Method sendInputEvent

src/main/api/plugin/input.ts:252–275  ·  view source on GitHub ↗
(
    inputEvent:
      | Electron.MouseInputEvent
      | Electron.MouseWheelInputEvent
      | Electron.KeyboardInputEvent
  )

Source from the content-addressed store, hash-verified

250 }
251
252 private sendInputEvent(
253 inputEvent:
254 | Electron.MouseInputEvent
255 | Electron.MouseWheelInputEvent
256 | Electron.KeyboardInputEvent
257 ): { success: boolean; error?: string } {
258 try {
259 if (this.pluginManager) {
260 const result = this.pluginManager.sendInputEvent(inputEvent)
261 if (result) {
262 return { success: true }
263 } else {
264 return { success: false, error: '没有活动的插件' }
265 }
266 }
267 return { success: false, error: '功能不可用' }
268 } catch (error: unknown) {
269 console.error('[PluginInput] 发送输入事件失败:', error)
270 return {
271 success: false,
272 error: error instanceof Error ? error.message : '未知错误'
273 }
274 }
275 }
276
277 /**
278 * 确保 webContents 上注册了 found-in-page 事件监听,避免重复注册

Callers 4

setupIPCMethod · 0.95
handleSendArrowKeyMethod · 0.45
pressMethod · 0.45
mouseEventMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected