diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-29 22:05:43 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-29 22:05:43 +0800 |
commit | df17c338988260aab4db8f946076a67f3323caba (patch) | |
tree | b89a71830e9bcd1cd3f13ffad25df04513d2143f /example/event.html | |
parent | c8ee08c24bee9ab994822066f9abe94448c4ae89 (diff) | |
download | go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.gz go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.bz2 go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.lz go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.xz go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.zst go-tangerine-df17c338988260aab4db8f946076a67f3323caba.zip |
event example
Diffstat (limited to 'example/event.html')
-rw-r--r-- | example/event.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/example/event.html b/example/event.html new file mode 100644 index 000000000..8191dfd8f --- /dev/null +++ b/example/event.html @@ -0,0 +1,67 @@ +<!doctype> +<html> + <head> + <script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script> + <script type="text/javascript" src="../dist/ethereum.js"></script> + <script type="text/javascript"> + var web3 = require('web3'); + web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); + + var desc = [{ + "type":"event", + "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}], + "name":"Event" + }, { + "type":"event", + "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}], + "name":"Event2" + }, { + "type":"function", + "inputs": [{"name":"a","type":"uint256"}], + "name":"foo", + "outputs": [] + }]; + + var address = '0x01'; + + var contract = web3.eth.contract(address, desc); + + function test1() { + web3.eth.watch(contract).changed(function (res) { + + }); + }; + + function test2() { + web3.eth.watch(contract.Event).changed(function (res) { + + }); + }; + + function test3() { + contract.Event().changed(function (res) { + + }); + }; + + // not valid + // function test4() { + // web3.eth.watch([contract.Event, contract.Event2]).changed(function (res) { + // }); + // }; + + </script> + </head> + + <body> + <div> + <button type="button" onClick="test1();">test1</button> + </div> + <div> + <button type="button" onClick="test2();">test2</button> + </div> + <div> + <button type="button" onClick="test3();">test3</button> + </div> + </body> +</html> |