diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-15 00:43:42 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-15 00:43:42 +0800 |
commit | ce242b10e2c4d35bbba3842d198b78373dd609f0 (patch) | |
tree | d65274497474e65302a91e78efa1796558aa4380 /packages/website/ts/web3_wrapper.ts | |
parent | 9ad9e1204ca93de2157119de72c17bf19b9b5379 (diff) | |
download | dexon-0x-contracts-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.gz dexon-0x-contracts-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.zst dexon-0x-contracts-ce242b10e2c4d35bbba3842d198b78373dd609f0.zip |
Reuse intervalutils in website
Diffstat (limited to 'packages/website/ts/web3_wrapper.ts')
-rw-r--r-- | packages/website/ts/web3_wrapper.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/website/ts/web3_wrapper.ts b/packages/website/ts/web3_wrapper.ts index b713f8a33..1bf7ffed5 100644 --- a/packages/website/ts/web3_wrapper.ts +++ b/packages/website/ts/web3_wrapper.ts @@ -1,4 +1,4 @@ -import {promisify} from '@0xproject/utils'; +import {intervalUtils, promisify} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import {Dispatcher} from 'ts/redux/dispatcher'; @@ -9,7 +9,7 @@ export class Web3Wrapper { private web3: Web3; private prevNetworkId: number; private shouldPollUserAddress: boolean; - private watchNetworkAndBalanceIntervalId: number; + private watchNetworkAndBalanceIntervalId: NodeJS.Timer; private prevUserEtherBalanceInEth: BigNumber; private prevUserAddress: string; constructor(dispatcher: Dispatcher, provider: Web3.Provider, networkIdIfExists: number, @@ -98,7 +98,7 @@ export class Web3Wrapper { let prevNodeVersion: string; this.prevUserEtherBalanceInEth = new BigNumber(0); this.dispatcher.updateNetworkId(this.prevNetworkId); - this.watchNetworkAndBalanceIntervalId = window.setInterval(async () => { + this.watchNetworkAndBalanceIntervalId = intervalUtils.setAsyncExcludingInterval(async () => { // Check for network state changes const currentNetworkId = await this.getNetworkIdIfExists(); if (currentNetworkId !== this.prevNetworkId) { |