From c524777505e6d75fbc34bf3d36853cbf0d883596 Mon Sep 17 00:00:00 2001 From: kPherox Date: Fri, 5 Apr 2019 19:49:18 +0900 Subject: [PATCH 1/2] Fix cannot repoen in macOS --- app/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/main.js b/app/main.js index bcaed309..29fa7e58 100644 --- a/app/main.js +++ b/app/main.js @@ -1,4 +1,4 @@ -'use strict'; + var dir='file://' + __dirname; var base=dir + '/view/'; // Electronのモジュール @@ -70,6 +70,12 @@ app.on('window-all-closed', function() { app.quit(); } }); +// macOSでウィンドウを閉じた後に再度開けるようにする +app.on('activate', function() { + if (mainWindow == null) { + createWindow(); + } +}); function createWindow() { // メイン画面の表示。ウィンドウの幅、高さを指定できる From f5afafe26a12465e9bd2cddc3bf95235bdd9b5e9 Mon Sep 17 00:00:00 2001 From: kPherox Date: Fri, 5 Apr 2019 20:43:37 +0900 Subject: [PATCH 2/2] Remove all listener when closed main window --- app/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/main.js b/app/main.js index 29fa7e58..a3bfd6e1 100644 --- a/app/main.js +++ b/app/main.js @@ -115,6 +115,7 @@ function createWindow() { } // ウィンドウが閉じられたらアプリも終了 mainWindow.on('closed', function() { + electron.ipcMain.removeAllListeners(); mainWindow = null; }); mainWindow.on('close', function() {