refs #6 Stop userstreaming when timeline space will destroy
This commit is contained in:
parent
41900126cd
commit
9b0728b724
|
@ -128,6 +128,8 @@ ipcMain.on('get-local-account', (event, id) => {
|
|||
})
|
||||
|
||||
// streaming
|
||||
let userStreaming = null
|
||||
|
||||
ipcMain.on('start-user-streaming', (event, ac) => {
|
||||
const account = new Account(db)
|
||||
account.getAccount(ac._id)
|
||||
|
@ -135,8 +137,8 @@ ipcMain.on('start-user-streaming', (event, ac) => {
|
|||
event.sender.send('error-start-user-streaming', err)
|
||||
})
|
||||
.then((account) => {
|
||||
const streaming = new Streaming(account)
|
||||
streaming.startUserStreaming(
|
||||
userStreaming = new Streaming(account)
|
||||
userStreaming.startUserStreaming(
|
||||
(update) => {
|
||||
event.sender.send('update-start-user-streaming', update)
|
||||
},
|
||||
|
@ -149,6 +151,12 @@ ipcMain.on('start-user-streaming', (event, ac) => {
|
|||
)
|
||||
})
|
||||
})
|
||||
|
||||
ipcMain.on('stop-user-streaming', (event, _) => {
|
||||
userStreaming.stop()
|
||||
userStreaming = null
|
||||
})
|
||||
|
||||
/**
|
||||
* Auto Updater
|
||||
*
|
||||
|
|
|
@ -25,6 +25,9 @@ export default {
|
|||
type: 'error'
|
||||
})
|
||||
})
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -72,6 +72,9 @@ const TimelineSpace = {
|
|||
ipcRenderer.on('notification-start-user-streaming', (event, notification) => {
|
||||
commit('appendNotification', notification)
|
||||
})
|
||||
},
|
||||
stopUserStreaming ({ commit }) {
|
||||
ipcRenderer.send('stop-user-streaming')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue