From 531897dada2e97351c5581f67274c2798925bcf5 Mon Sep 17 00:00:00 2001 From: Lucas Gomes Date: Tue, 20 Mar 2018 22:05:21 +0000 Subject: [PATCH 1/3] Error when trying to close the Window two times Don't know if my code or module, but either way it seems to fix the problem --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 42698ce..ca008d6 100644 --- a/index.js +++ b/index.js @@ -64,13 +64,17 @@ module.exports = function (config, windowParams) { reject(error); authWindow.removeAllListeners('closed'); setImmediate(function () { - authWindow.close(); + if(!authWindow.isDestroyed()){ + authWindow.close(); + } }); } else if (code) { resolve(code); authWindow.removeAllListeners('closed'); setImmediate(function () { - authWindow.close(); + if(!authWindow.isDestroyed()){ + authWindow.close(); + } }); } } From a6edafb6df86270ea09fb22544a28be7f24e3e13 Mon Sep 17 00:00:00 2001 From: DREZZ3R <35097489+DREZZ3R@users.noreply.github.com> Date: Mon, 26 Mar 2018 11:46:04 +0100 Subject: [PATCH 2/3] attempt to reduce window flashing --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ca008d6..41dd724 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,10 @@ module.exports = function (config, windowParams) { const authWindow = new BrowserWindow(windowParams || {'use-content-size': true}); authWindow.loadURL(url); - authWindow.show(); + authWindow.once('ready-to-show', () => { + authWindow.show() + }) + authWindow.on('closed', () => { reject(new Error('window was closed by user')); From fb47033f1d4a13c213ba4a1d0efd02dbcd111a3c Mon Sep 17 00:00:00 2001 From: DREZZ3R <35097489+DREZZ3R@users.noreply.github.com> Date: Mon, 26 Mar 2018 11:54:56 +0100 Subject: [PATCH 3/3] added semicolons --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 41dd724..65e905c 100644 --- a/index.js +++ b/index.js @@ -49,8 +49,8 @@ module.exports = function (config, windowParams) { authWindow.loadURL(url); authWindow.once('ready-to-show', () => { - authWindow.show() - }) + authWindow.show(); + }); authWindow.on('closed', () => {