本文整理匯總了TypeScript中ts/redux/dispatcher.Dispatcher.updateTokenByAddress方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Dispatcher.updateTokenByAddress方法的具體用法?TypeScript Dispatcher.updateTokenByAddress怎麽用?TypeScript Dispatcher.updateTokenByAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ts/redux/dispatcher.Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.updateTokenByAddress方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: clearInterval
this.zrxPollIntervalId = window.setInterval(async () => {
const [balance] = await this.getTokenBalanceAndAllowanceAsync(this.userAddress, token.address);
if (!balance.eq(currBalance)) {
token.balance = balance;
this.dispatcher.updateTokenByAddress([token]);
clearInterval(this.zrxPollIntervalId);
delete this.zrxPollIntervalId;
}
}, 5000);
示例2: updateTokenBalancesAndAllowancesAsync
public async updateTokenBalancesAndAllowancesAsync(tokens: Token[]) {
const updatedTokens = [];
for (const token of tokens) {
if (_.isUndefined(token.address)) {
continue; // Cannot retrieve balance for tokens without an address
}
const [balance, allowance] = await this.getTokenBalanceAndAllowanceAsync(this.userAddress, token.address);
updatedTokens.push(_.assign({}, token, {
balance,
allowance,
}));
}
this.dispatcher.updateTokenByAddress(updatedTokens);
}