Merge pull request #107 from Flet/pause-on-hide

dispatch a pause event before hiding window on darwin
This commit is contained in:
Feross Aboukhadijeh 2016-03-09 02:18:40 -08:00
commit fe524f8432
2 changed files with 7 additions and 1 deletions

View file

@ -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()
})
}
})

View file

@ -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()