diff --git a/routes/_actions/instances.js b/routes/_actions/instances.js index 893f660..0682819 100644 --- a/routes/_actions/instances.js +++ b/routes/_actions/instances.js @@ -67,8 +67,7 @@ export async function updateVerifyCredentialsForInstance (instanceName) { ) } - -export async function updateInstanceInfo(instanceName) { +export async function updateInstanceInfo (instanceName) { await cacheFirstUpdateAfter( () => getInstanceInfo(instanceName), () => database.getInstanceInfo(instanceName), @@ -79,4 +78,4 @@ export async function updateInstanceInfo(instanceName) { store.set({instanceInfos: instanceInfos}) } ) -} \ No newline at end of file +} diff --git a/routes/_actions/pinnedStatuses.js b/routes/_actions/pinnedStatuses.js index 4956c0e..9e6e10f 100644 --- a/routes/_actions/pinnedStatuses.js +++ b/routes/_actions/pinnedStatuses.js @@ -3,7 +3,7 @@ import { cacheFirstUpdateAfter } from '../_utils/sync' import { getPinnedStatuses } from '../_api/pinnedStatuses' import { database } from '../_database/database' -export async function updatePinnedStatusesForAccount(accountId) { +export async function updatePinnedStatusesForAccount (accountId) { let instanceName = store.get('currentInstance') let accessToken = store.get('accessToken') @@ -18,6 +18,4 @@ export async function updatePinnedStatusesForAccount(accountId) { store.set({pinnedStatuses: $pinnedStatuses}) } ) - - -} \ No newline at end of file +} diff --git a/routes/_actions/search.js b/routes/_actions/search.js index 990c0d2..2fb25d8 100644 --- a/routes/_actions/search.js +++ b/routes/_actions/search.js @@ -2,7 +2,7 @@ import { store } from '../_store/store' import { toast } from '../_utils/toast' import { search } from '../_api/search' -export async function doSearch() { +export async function doSearch () { let instanceName = store.get('currentInstance') let accessToken = store.get('accessToken') let queryInSearch = store.get('queryInSearch') @@ -22,4 +22,4 @@ export async function doSearch() { } finally { store.set({searchLoading: false}) } -} \ No newline at end of file +} diff --git a/routes/_actions/streaming.js b/routes/_actions/streaming.js index a584fef..f0efbef 100644 --- a/routes/_actions/streaming.js +++ b/routes/_actions/streaming.js @@ -50,8 +50,8 @@ function handleStreamMessage (instanceName, timelineName, message) { } export function createStream (streamingApi, instanceName, accessToken, timelineName) { - new TimelineStream(streamingApi, accessToken, timelineName, { - onMessage(msg) { + return new TimelineStream(streamingApi, accessToken, timelineName, { + onMessage (msg) { console.log('message', msg) if (msg.event !== 'update' && msg.event !== 'delete') { console.error("don't know how to handle event", msg) @@ -61,14 +61,14 @@ export function createStream (streamingApi, instanceName, accessToken, timelineN handleStreamMessage(instanceName, timelineName, msg) }) }, - onOpen() { + onOpen () { console.log('opened stream for timeline', timelineName) }, - onClose() { + onClose () { console.log('closed stream for timeline', timelineName) }, - onReconnect() { + onReconnect () { console.log('reconnected stream for timeline', timelineName) } }) -} \ No newline at end of file +} diff --git a/routes/_database/timelines.js b/routes/_database/timelines.js index ac2eca4..46f4daf 100644 --- a/routes/_database/timelines.js +++ b/routes/_database/timelines.js @@ -57,7 +57,7 @@ function cloneForStorage (obj) { return res } -function cacheStatus(status, instanceName) { +function cacheStatus (status, instanceName) { setInCache(statusesCache, instanceName, status.id, status) setInCache(accountsCache, instanceName, status.account.id, status.account) if (status.reblog) { @@ -318,4 +318,4 @@ export async function getPinnedStatuses (instanceName, accountId) { callback(res) } }) -} \ No newline at end of file +} diff --git a/routes/_store/instanceObservers.js b/routes/_store/instanceObservers.js index a97a214..715b411 100644 --- a/routes/_store/instanceObservers.js +++ b/routes/_store/instanceObservers.js @@ -10,4 +10,4 @@ export function instanceObservers (store) { updateInstanceInfo(currentInstance) updateLists() }) -} \ No newline at end of file +} diff --git a/routes/_store/timelineObservers.js b/routes/_store/timelineObservers.js index 927b148..db6207f 100644 --- a/routes/_store/timelineObservers.js +++ b/routes/_store/timelineObservers.js @@ -2,7 +2,6 @@ import { updateInstanceInfo } from '../_actions/instances' import { createStream } from '../_actions/streaming' export function timelineObservers (store) { - let currentTimelineStream store.observe('currentTimeline', async (currentTimeline) => { diff --git a/routes/_utils/ajax.js b/routes/_utils/ajax.js index a081d46..f7cf4d7 100644 --- a/routes/_utils/ajax.js +++ b/routes/_utils/ajax.js @@ -1,6 +1,6 @@ const TIMEOUT = 15000 -function fetchWithTimeout(url, options) { +function fetchWithTimeout (url, options) { return Promise.race([ fetch(url, options), new Promise((resolve, reject) => {