跳转到主要内容

IpcMainEvent 对象扩展了 Event

  • type String - 可能的值包括 frame
  • processId Integer - 发送此消息的渲染器进程的内部 ID
  • frameId Integer - 发送此消息的渲染器框架的 ID
  • returnValue any - 设置此值以在同步消息中返回
  • sender WebContents - 返回发送消息的 webContents
  • senderFrame WebFrameMain | null 只读 - 发送此消息的框架。如果访问的时间晚于框架导航或销毁,则可能为 null
  • ports MessagePortMain[] - 随此消息传输的 MessagePort 列表
  • reply Function - 一个函数,它会将 IPC 消息发送到您当前正在处理的原始消息所发送的渲染器框架。您应该使用此方法“回复”发送的消息,以确保回复会发送到正确的进程和框架。
    • channel string
    • ...args any[]