will-finish-launching
:应用完成基本启动ready
:应用完成初始化时window-all-closed
:所有窗口关闭时before-quit
:应用准备退出时,可以通过event.preventDefault()
取消退出will-quit
:当所有窗口都已关闭并且应用将退出quit
:应用退出
在
Windows
上,如果应用由于系统关闭/重新启动或用户注销而关闭,则不会发出此事件。
在preload.ts
中暴露IPC
方法
其他的API
ipcRenderer.once
: 类似于ipcRenderer.on
,但只监听一次事件
ipcRenderer.sendSync
: 类似于ipcRenderer.send
,但它时同步的,会阻塞渲染进程,直到接收到回复
ipcRenderer.postMessage
: 类似于ipcRenderer.on
,向主进程发送消息,可选择转移零个或多个MessagePort
对象的所有权。
ipcRenderer.sendToHost
:类似于ipcRenderer.send
,但事件将被发送到主页中的<webview>
元素而不是主进程。
ipcRenderer.sendTo
: 类似于ipcRenderer.send
,但事件将被发送到指定的其他渲染进程,v28
起已弃用。