diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-30 20:47:18 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-30 20:47:18 +0800 |
commit | af927ffdaf0c2c31047d22ab4a3163a4ef9d2342 (patch) | |
tree | 5269be68210713e977635069cdcb52bbf36396e3 /cmd/mist | |
parent | c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7 (diff) | |
download | go-tangerine-af927ffdaf0c2c31047d22ab4a3163a4ef9d2342.tar.gz go-tangerine-af927ffdaf0c2c31047d22ab4a3163a4ef9d2342.tar.zst go-tangerine-af927ffdaf0c2c31047d22ab4a3163a4ef9d2342.zip |
Added whisper messages
* have identity & get messages
Diffstat (limited to 'cmd/mist')
-rw-r--r-- | cmd/mist/assets/examples/whisper.html | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/cmd/mist/assets/examples/whisper.html b/cmd/mist/assets/examples/whisper.html index 51d7004de..6a7143eef 100644 --- a/cmd/mist/assets/examples/whisper.html +++ b/cmd/mist/assets/examples/whisper.html @@ -13,9 +13,19 @@ <table width="100%" id="table"> <tr> + <td>Count</td> + <td id="count"></td> + </tr> + + <tr> <td>ID</td> <td id="id"></td> </tr> + + <tr> + <td>Has identity</td> + <td id="known"></td> + </tr> </table> </body> @@ -27,13 +37,21 @@ var id = shh.newIdentity(); document.querySelector("#id").innerHTML = id; + document.querySelector("#known").innerHTML = shh.haveIdentity(id); - shh.watch({topics: ["test"]}).arrived(function(message) { + var watch = shh.watch({topics: ["test"]}) + watch.arrived(function(message) { document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>"; }); function test() { - shh.post({topics: ["test"], payload: web3.fromAscii("test it")}) + shh.post({topics: ["test"], payload: web3.fromAscii("test it")}); + count(); + + } + + function count() { + document.querySelector("#count").innerHTML = watch.messages().length; } </script> |