diff options
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/heartbeater.ts (renamed from packages/instant/src/util/hearbeats.ts) | 23 | ||||
-rw-r--r-- | packages/instant/src/util/heartbeater_factory.ts | 18 |
2 files changed, 18 insertions, 23 deletions
diff --git a/packages/instant/src/util/hearbeats.ts b/packages/instant/src/util/heartbeater.ts index ecd7c5068..c5a823953 100644 --- a/packages/instant/src/util/hearbeats.ts +++ b/packages/instant/src/util/heartbeater.ts @@ -1,14 +1,4 @@ -// TODO: rename file - import * as _ from 'lodash'; -import { Dispatch } from 'redux'; - -import { Action } from '../redux/actions'; -import { asyncData } from '../redux/async_data'; -import { State } from '../redux/reducer'; -import { Store } from '../redux/store'; - -import { updateBuyQuoteOrFlashErrorAsyncForState } from './buy_quote_fetcher'; type HeartbeatableFunction = () => Promise<void>; export class Heartbeater { @@ -50,16 +40,3 @@ export class Heartbeater { } } } - -export const generateAccountHeartbeater = (store: Store): Heartbeater => { - return new Heartbeater(async () => { - await asyncData.fetchAccountInfoAndDispatchToStore(store, { setLoading: false }); - }); -}; - -export const generateBuyQuoteHeartbeater = (store: Store): Heartbeater => { - return new Heartbeater(async () => { - await updateBuyQuoteOrFlashErrorAsyncForState(store.getState(), store.dispatch); - return Promise.resolve(); - }); -}; diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts new file mode 100644 index 000000000..fc33787ee --- /dev/null +++ b/packages/instant/src/util/heartbeater_factory.ts @@ -0,0 +1,18 @@ +import { asyncData } from '../redux/async_data'; +import { Store } from '../redux/store'; + +import { updateBuyQuoteOrFlashErrorAsyncForState } from './buy_quote_fetcher'; +import { Heartbeater } from './heartbeater'; + +export const generateAccountHeartbeater = (store: Store): Heartbeater => { + return new Heartbeater(async () => { + await asyncData.fetchAccountInfoAndDispatchToStore(store, { setLoading: false }); + }); +}; + +export const generateBuyQuoteHeartbeater = (store: Store): Heartbeater => { + return new Heartbeater(async () => { + await updateBuyQuoteOrFlashErrorAsyncForState(store.getState(), store.dispatch); + return Promise.resolve(); + }); +}; |