diff options
-rw-r--r-- | packages/instant/src/components/zero_ex_instant_provider.tsx | 3 | ||||
-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 |
3 files changed, 20 insertions, 24 deletions
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx index 24ae0c4b6..bbc20dab6 100644 --- a/packages/instant/src/components/zero_ex_instant_provider.tsx +++ b/packages/instant/src/components/zero_ex_instant_provider.tsx @@ -15,7 +15,8 @@ import { AffiliateInfo, AssetMetaData, Network, OrderSource } from '../types'; import { assetUtils } from '../util/asset'; import { errorFlasher } from '../util/error_flasher'; import { gasPriceEstimator } from '../util/gas_price_estimator'; -import { generateAccountHeartbeater, Heartbeater, generateBuyQuoteHeartbeater } from '../util/hearbeats'; +import { Heartbeater } from '../util/heartbeater'; +import { generateAccountHeartbeater, generateBuyQuoteHeartbeater } from '../util/heartbeater_factory'; import { providerStateFactory } from '../util/provider_state_factory'; fonts.include(); 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(); + }); +}; |