mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-07 23:38:48 +01:00
Fix bind method when reloading
This commit is contained in:
parent
1fac44b79e
commit
470160ee6f
@ -73,7 +73,9 @@ export default {
|
||||
window.removeEventListener('dragover', this.onDragOver)
|
||||
window.removeEventListener('drop', this.handleDrop)
|
||||
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
||||
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
||||
},
|
||||
methods: {
|
||||
async clear () {
|
||||
@ -120,6 +122,7 @@ export default {
|
||||
})
|
||||
}
|
||||
this.$store.dispatch('TimelineSpace/SideMenu/fetchLists', account)
|
||||
this.$store.dispatch('TimelineSpace/bindUserStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
@ -127,6 +130,7 @@ export default {
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
this.$store.dispatch('TimelineSpace/bindLocalStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
||||
this.$store.dispatch('TimelineSpace/fetchInstance', account)
|
||||
|
@ -87,7 +87,7 @@ const TimelineSpace = {
|
||||
})
|
||||
})
|
||||
},
|
||||
startUserStreaming ({ state, commit, rootState }, account) {
|
||||
bindUserStreaming ({ commit, rootState }, account) {
|
||||
ipcRenderer.on('update-start-user-streaming', (event, update) => {
|
||||
commit('TimelineSpace/Contents/Home/appendTimeline', update, { root: true })
|
||||
// Sometimes archive old statuses
|
||||
@ -109,7 +109,8 @@ const TimelineSpace = {
|
||||
}
|
||||
commit('TimelineSpace/SideMenu/changeUnreadNotifications', true, { root: true })
|
||||
})
|
||||
|
||||
},
|
||||
startUserStreaming (_, account) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.send('start-user-streaming', account)
|
||||
ipcRenderer.once('error-start-user-streaming', (event, err) => {
|
||||
@ -117,7 +118,7 @@ const TimelineSpace = {
|
||||
})
|
||||
})
|
||||
},
|
||||
startLocalStreaming ({ state, commit, rootState }, account) {
|
||||
bindLocalStreaming ({ commit, rootState }) {
|
||||
ipcRenderer.on('update-start-local-streaming', (event, update) => {
|
||||
commit('TimelineSpace/Contents/Local/appendTimeline', update, { root: true })
|
||||
if (rootState.TimelineSpace.Contents.Local.heading && Math.random() > 0.8) {
|
||||
@ -125,6 +126,8 @@ const TimelineSpace = {
|
||||
}
|
||||
commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', true, { root: true })
|
||||
})
|
||||
},
|
||||
startLocalStreaming (_, account) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.send('start-local-streaming', account)
|
||||
ipcRenderer.once('error-start-local-streaming', (event, err) => {
|
||||
@ -132,18 +135,20 @@ const TimelineSpace = {
|
||||
})
|
||||
})
|
||||
},
|
||||
async stopUserStreaming ({ commit }) {
|
||||
unbindUserStreaming () {
|
||||
ipcRenderer.removeAllListeners('update-start-user-streaming')
|
||||
ipcRenderer.removeAllListeners('notification-start-user-streaming')
|
||||
ipcRenderer.removeAllListeners('error-start-user-streaming')
|
||||
ipcRenderer.send('stop-user-streaming')
|
||||
return 'stopUserStreaming'
|
||||
},
|
||||
async stopLocalStreaming ({ commit }) {
|
||||
stopUserStreaming () {
|
||||
ipcRenderer.send('stop-user-streaming')
|
||||
},
|
||||
unbindLocalStreaming () {
|
||||
ipcRenderer.removeAllListeners('error-start-local-streaming')
|
||||
ipcRenderer.removeAllListeners('update-start-local-streaming')
|
||||
},
|
||||
stopLocalStreaming () {
|
||||
ipcRenderer.send('stop-local-streaming')
|
||||
return 'stopLocalStreaming'
|
||||
},
|
||||
watchShortcutEvents ({ commit, dispatch }) {
|
||||
ipcRenderer.on('CmdOrCtrl+N', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user