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('dragover', this.onDragOver)
|
||||||
window.removeEventListener('drop', this.handleDrop)
|
window.removeEventListener('drop', this.handleDrop)
|
||||||
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
||||||
|
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||||
|
this.$store.dispatch('TimelineSpace/unbindUserStreaming')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async clear () {
|
async clear () {
|
||||||
|
@ -120,6 +122,7 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$store.dispatch('TimelineSpace/SideMenu/fetchLists', account)
|
this.$store.dispatch('TimelineSpace/SideMenu/fetchLists', account)
|
||||||
|
this.$store.dispatch('TimelineSpace/bindUserStreaming', account)
|
||||||
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -127,6 +130,7 @@ export default {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
this.$store.dispatch('TimelineSpace/bindLocalStreaming', account)
|
||||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
||||||
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
||||||
this.$store.dispatch('TimelineSpace/fetchInstance', 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) => {
|
ipcRenderer.on('update-start-user-streaming', (event, update) => {
|
||||||
commit('TimelineSpace/Contents/Home/appendTimeline', update, { root: true })
|
commit('TimelineSpace/Contents/Home/appendTimeline', update, { root: true })
|
||||||
// Sometimes archive old statuses
|
// Sometimes archive old statuses
|
||||||
|
@ -109,7 +109,8 @@ const TimelineSpace = {
|
||||||
}
|
}
|
||||||
commit('TimelineSpace/SideMenu/changeUnreadNotifications', true, { root: true })
|
commit('TimelineSpace/SideMenu/changeUnreadNotifications', true, { root: true })
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
startUserStreaming (_, account) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ipcRenderer.send('start-user-streaming', account)
|
ipcRenderer.send('start-user-streaming', account)
|
||||||
ipcRenderer.once('error-start-user-streaming', (event, err) => {
|
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) => {
|
ipcRenderer.on('update-start-local-streaming', (event, update) => {
|
||||||
commit('TimelineSpace/Contents/Local/appendTimeline', update, { root: true })
|
commit('TimelineSpace/Contents/Local/appendTimeline', update, { root: true })
|
||||||
if (rootState.TimelineSpace.Contents.Local.heading && Math.random() > 0.8) {
|
if (rootState.TimelineSpace.Contents.Local.heading && Math.random() > 0.8) {
|
||||||
|
@ -125,6 +126,8 @@ const TimelineSpace = {
|
||||||
}
|
}
|
||||||
commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', true, { root: true })
|
commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', true, { root: true })
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
startLocalStreaming (_, account) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ipcRenderer.send('start-local-streaming', account)
|
ipcRenderer.send('start-local-streaming', account)
|
||||||
ipcRenderer.once('error-start-local-streaming', (event, err) => {
|
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('update-start-user-streaming')
|
||||||
ipcRenderer.removeAllListeners('notification-start-user-streaming')
|
ipcRenderer.removeAllListeners('notification-start-user-streaming')
|
||||||
ipcRenderer.removeAllListeners('error-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('error-start-local-streaming')
|
||||||
ipcRenderer.removeAllListeners('update-start-local-streaming')
|
ipcRenderer.removeAllListeners('update-start-local-streaming')
|
||||||
|
},
|
||||||
|
stopLocalStreaming () {
|
||||||
ipcRenderer.send('stop-local-streaming')
|
ipcRenderer.send('stop-local-streaming')
|
||||||
return 'stopLocalStreaming'
|
|
||||||
},
|
},
|
||||||
watchShortcutEvents ({ commit, dispatch }) {
|
watchShortcutEvents ({ commit, dispatch }) {
|
||||||
ipcRenderer.on('CmdOrCtrl+N', () => {
|
ipcRenderer.on('CmdOrCtrl+N', () => {
|
||||||
|
|
Loading…
Reference in New Issue