From af927ffdaf0c2c31047d22ab4a3163a4ef9d2342 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 30 Jan 2015 13:47:18 +0100 Subject: Added whisper messages * have identity & get messages --- cmd/mist/assets/examples/whisper.html | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'cmd/mist') 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 @@ -12,10 +12,20 @@ + + + + + + + + + +
Count
ID
Has identity
@@ -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 += ""+JSON.stringify(message)+""; }); 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; } -- cgit v1.2.3