diff options
| author | Henry Jameson <me@hjkos.com> | 2019-12-10 21:30:27 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-12-10 21:30:27 +0200 |
| commit | 6acd889589e46b18491d96b5fa992154b4e58d88 (patch) | |
| tree | debcdf1551aa869703bc032ee57b55266e8bc788 /src/modules/api.js | |
| parent | 505fb260610e557e27bbc5d27515337ea07e0e3e (diff) | |
Option to enable streaming
Diffstat (limited to 'src/modules/api.js')
| -rw-r--r-- | src/modules/api.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/api.js b/src/modules/api.js index 593f8498..dc91d00e 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -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, { |
