From c9693b47467f16a6f35be6de85f57244b70d7a01 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 21 Jan 2015 21:12:07 +0100 Subject: contract.html example is working with sync api --- example/balance.html | 16 +++++++--------- example/contract.html | 14 ++++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'example') diff --git a/example/balance.html b/example/balance.html index 53a65805f..60b8bbe87 100644 --- a/example/balance.html +++ b/example/balance.html @@ -14,17 +14,15 @@ var coinbase = web3.eth.coinbase; var originalBalance = 0; - web3.eth.balanceAt(coinbase).then(function (balance) { - originalBalance = web3.toDecimal(balance); - document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...'; - }); + var balance = web3.eth.balanceAt(coinbase); + var originalBalance = web3.toDecimal(balance); + document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...'; web3.eth.watch({altered: coinbase}).changed(function() { - web3.eth.balanceAt(coinbase).then(function (balance) { - var currentBalance = web3.toDecimal(balance); - document.getElementById("current").innerText = 'current: ' + currentBalance; - document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance); - }); + balance = web3.eth.balanceAt(coinbase) + var currentBalance = web3.toDecimal(balance); + document.getElementById("current").innerText = 'current: ' + currentBalance; + document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance); }); } diff --git a/example/contract.html b/example/contract.html index a3f0df176..3d0260d34 100644 --- a/example/contract.html +++ b/example/contract.html @@ -8,7 +8,7 @@ -- cgit v1.2.3