diff options
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/buy_quote_updater.ts | 2 | ||||
-rw-r--r-- | packages/instant/src/util/heartbeater.ts | 5 | ||||
-rw-r--r-- | packages/instant/src/util/heartbeater_factory.ts | 14 |
3 files changed, 10 insertions, 11 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts index fb5da311d..c33e28f1c 100644 --- a/packages/instant/src/util/buy_quote_updater.ts +++ b/packages/instant/src/util/buy_quote_updater.ts @@ -1,5 +1,4 @@ import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer'; -import { AssetProxyId } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import * as _ from 'lodash'; @@ -7,7 +6,6 @@ import { Dispatch } from 'redux'; import { oc } from 'ts-optchain'; import { Action, actions } from '../redux/actions'; -import { State } from '../redux/reducer'; import { AffiliateInfo, ERC20Asset } from '../types'; import { assetUtils } from '../util/asset'; import { errorFlasher } from '../util/error_flasher'; diff --git a/packages/instant/src/util/heartbeater.ts b/packages/instant/src/util/heartbeater.ts index 87af48423..a5b42d87f 100644 --- a/packages/instant/src/util/heartbeater.ts +++ b/packages/instant/src/util/heartbeater.ts @@ -4,8 +4,8 @@ type HeartbeatableFunction = () => Promise<void>; export class Heartbeater { private _intervalId?: number; private _hasPendingRequest: boolean; - private _performImmediatelyOnStart: boolean; - private _performFunction: HeartbeatableFunction; + private readonly _performImmediatelyOnStart: boolean; + private readonly _performFunction: HeartbeatableFunction; public constructor(performingFunctionAsync: HeartbeatableFunction, performImmediatelyOnStart: boolean) { this._performFunction = performingFunctionAsync; @@ -19,6 +19,7 @@ export class Heartbeater { } if (this._performImmediatelyOnStart) { + // tslint:disable-next-line:no-floating-promises this._trackAndPerformAsync(); } diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts index 805483b71..96a8ac4e6 100644 --- a/packages/instant/src/util/heartbeater_factory.ts +++ b/packages/instant/src/util/heartbeater_factory.ts @@ -5,18 +5,18 @@ import { Heartbeater } from './heartbeater'; export interface HeartbeatFactoryOptions { store: Store; - performImmediatelyOnStart: boolean; + shouldPerformImmediatelyOnStart: boolean; } export const generateAccountHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => { - const { store, performImmediatelyOnStart } = options; + const { store, shouldPerformImmediatelyOnStart } = options; return new Heartbeater(async () => { - await asyncData.fetchAccountInfoAndDispatchToStore({ store, setLoading: false }); - }, performImmediatelyOnStart); + await asyncData.fetchAccountInfoAndDispatchToStore({ store, shouldSetToLoading: false }); + }, shouldPerformImmediatelyOnStart); }; export const generateBuyQuoteHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => { - const { store, performImmediatelyOnStart } = options; + const { store, shouldPerformImmediatelyOnStart } = options; return new Heartbeater(async () => { - await asyncData.fetchCurrentBuyQuoteAndDispatchToStore({ store, setPending: false }); - }, performImmediatelyOnStart); + await asyncData.fetchCurrentBuyQuoteAndDispatchToStore({ store, shouldSetPending: false }); + }, shouldPerformImmediatelyOnStart); }; |