Merge pull request #278 from h3poteto/iss-104

fixes #104 Stop streaming when window is closed in macOS
This commit is contained in:
AkiraFukushima 2018-04-30 20:38:28 +09:00 committed by GitHub
commit f5defe9629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()
}