diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-09 08:54:45 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-09 08:54:45 +0800 |
commit | e45b6c7e98a33de0e13f4ab7db8b630900dbb960 (patch) | |
tree | 12ca1aeb83063015b3124c6025af99abd3d3d5ea /packages/instant/src/components | |
parent | dd4d3b10cf8c0bb08f981128232d3663d01806eb (diff) | |
download | dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.tar dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.tar.gz dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.tar.bz2 dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.tar.lz dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.tar.xz dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.tar.zst dexon-sol-tools-e45b6c7e98a33de0e13f4ab7db8b630900dbb960.zip |
Make heartbeat more generic
Diffstat (limited to 'packages/instant/src/components')
-rw-r--r-- | packages/instant/src/components/zero_ex_instant_provider.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx index 02f14c5b6..1805a11af 100644 --- a/packages/instant/src/components/zero_ex_instant_provider.tsx +++ b/packages/instant/src/components/zero_ex_instant_provider.tsx @@ -15,7 +15,7 @@ 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 { AccountUpdateHeartbeat } from '../util/hearbeats'; +import { generateAccountHeartbeater, Heartbeater } from '../util/hearbeats'; import { providerStateFactory } from '../util/provider_state_factory'; fonts.include(); @@ -39,7 +39,7 @@ export interface ZeroExInstantProviderOptionalProps { export class ZeroExInstantProvider extends React.Component<ZeroExInstantProviderProps> { private readonly _store: Store; - private _accountUpdateHeartbeat?: AccountUpdateHeartbeat; + private _accountUpdateHeartbeat?: Heartbeater; // TODO(fragosti): Write tests for this beast once we inject a provider. private static _mergeDefaultStateWithProps( props: ZeroExInstantProviderProps, @@ -97,8 +97,9 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider } // tslint:disable-next-line:no-floating-promises // asyncData.fetchAccountInfoAndDispatchToStore(this._store); - this._accountUpdateHeartbeat = new AccountUpdateHeartbeat(); - this._accountUpdateHeartbeat.start(this._store, ACCOUNT_UPDATE_INTERVAL_TIME_MS); + + this._accountUpdateHeartbeat = generateAccountHeartbeater(this._store); + this._accountUpdateHeartbeat.start(ACCOUNT_UPDATE_INTERVAL_TIME_MS); // warm up the gas price estimator cache just in case we can't // grab the gas price estimate when submitting the transaction |