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/blockchain.ts | |
parent | 9ad9e1204ca93de2157119de72c17bf19b9b5379 (diff) | |
download | dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.gz dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.bz2 dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.lz dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.xz dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.tar.zst dexon-sol-tools-ce242b10e2c4d35bbba3842d198b78373dd609f0.zip |
Reuse intervalutils in website
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 172ba6b52..321a603ef 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -23,7 +23,7 @@ import { LedgerWalletSubprovider, RedundantRPCSubprovider, } from '@0xproject/subproviders'; -import {promisify} from '@0xproject/utils'; +import {intervalUtils, promisify} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; import compareVersions = require('compare-versions'); import ethUtil = require('ethereumjs-util'); @@ -75,7 +75,7 @@ export class Blockchain { private userAddress: string; private cachedProvider: Web3.Provider; private ledgerSubprovider: LedgerWalletSubprovider; - private zrxPollIntervalId: number; + private zrxPollIntervalId: NodeJS.Timer; private static async onPageLoadAsync() { if (document.readyState === 'complete') { return; // Already loaded @@ -359,7 +359,7 @@ export class Blockchain { const [currBalance] = await this.getTokenBalanceAndAllowanceAsync(this.userAddress, token.address); - this.zrxPollIntervalId = window.setInterval(async () => { + this.zrxPollIntervalId = intervalUtils.setAsyncExcludingInterval(async () => { const [balance] = await this.getTokenBalanceAndAllowanceAsync(this.userAddress, token.address); if (!balance.eq(currBalance)) { this.dispatcher.replaceTokenBalanceByAddress(token.address, balance); |