跳至主要内容

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[]