📜  来自渲染器的电子退出应用程序 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:59.638000             🧑  作者: Mango

代码示例1
// In your renderer process
const {ipcRenderer} = require('electron');
const closeApp = document.getElementById('closeApp');
closeApp.addEventListener('click', () => {
    ipcRenderer.send('close-me')
});

// In your app main process
const {ipcMain} = require('electron')
ipcMain.on('close-me', (evt, arg) => {
  app.quit()
})