Option to enable streaming

This commit is contained in:
Henry Jameson 2019-12-10 21:30:27 +02:00
parent 505fb26061
commit 6acd889589
8 changed files with 62 additions and 4 deletions

View file

@ -31,6 +31,18 @@ const api = {
}
},
actions: {
// Global MastoAPI socket control, in future should disable ALL sockets/(re)start relevant sockets
enableMastoSockets (store) {
const { state, dispatch } = store
if (state.mastoUserSocket) return
dispatch('startMastoUserSocket')
},
disableMastoSockets (store) {
const { state, dispatch } = store
if (!state.mastoUserSocket) return
dispatch('stopMastoUserSocket')
},
// MastoAPI 'User' sockets
startMastoUserSocket (store) {
const { state, dispatch } = store
@ -81,6 +93,12 @@ const api = {
dispatch('stopFetchingNotifications')
})
},
stopMastoUserSocket ({ state, dispatch }) {
dispatch('startFetchingTimeline', { timeline: 'friends' })
dispatch('startFetchingNotifications')
console.log(state.mastoUserSocket)
state.mastoUserSocket.close()
},
// Timelines
startFetchingTimeline (store, {