From e686aa8d020c3efaa44f578c92ce7b5d40229511 Mon Sep 17 00:00:00 2001 From: Dan Flettre Date: Tue, 8 Mar 2016 22:40:51 -0600 Subject: [PATCH] dispatch a pause event before hiding window on darwin --- main/windows.js | 4 +++- renderer/index.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main/windows.js b/main/windows.js index 326c1f26..5ea6b7b0 100644 --- a/main/windows.js +++ b/main/windows.js @@ -48,7 +48,9 @@ function createMainWindow (menu) { win.on('close', function (e) { if (process.platform === 'darwin' && !isQuitting) { e.preventDefault() - win.hide() + win.webContents.executeJavaScript('dispatch("pause")', function () { + win.hide() + }) } }) diff --git a/renderer/index.js b/renderer/index.js index 794871b0..ba62640b 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -187,6 +187,10 @@ function dispatch (action, ...args) { // TODO // window.history.forward() } + if (action === 'pause') { + state.video.isPaused = true + update() + } if (action === 'playPause') { state.video.isPaused = !state.video.isPaused update()