fixes #104 Stop streaming when window is closed in macOS

This commit is contained in:
AkiraFukushima 2018-04-30 20:11:38 +09:00
parent 07d510ccac
commit b330c1cfbb
1 changed files with 7 additions and 0 deletions

View File

@ -229,7 +229,14 @@ app.commandLine.appendSwitch('disable-renderer-backgrounding')
app.on('ready', createWindow)
// In macOS, this method is called when user click x button.
// When this time, streaming must stop.
// https://github.com/electron/electron/blob/master/docs/api/app.md#event-window-all-closed
app.on('window-all-closed', () => {
if (userStreaming !== null) {
userStreaming.stop()
userStreaming = null
}
if (process.platform !== 'darwin') {
app.quit()
}