aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2013-11-08 23:08:57 -0600
committerDavid Barksdale <amatus@amatus.name>2013-11-08 23:08:57 -0600
commit2286915b8e87d39ccd1bb6722d7499f19dfcdb7d (patch)
tree0c38ebc6b0d0a75b8cb3a93fd93c4750db8f7b74 /src
parent197703e1a190633df2c000d23e3690e6148a7088 (diff)
Added ability to send messages to peerinfo service
To test this out input the message to send as an array of bytes and press the "Send Message" button. To send a malformed GNUNET_HELLO_Message try: [0,0,17,0]
Diffstat (limited to 'src')
-rw-r--r--src/cljs/gnunet_web/ui.cljs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cljs/gnunet_web/ui.cljs b/src/cljs/gnunet_web/ui.cljs
index 0f1b867..8fe9d75 100644
--- a/src/cljs/gnunet_web/ui.cljs
+++ b/src/cljs/gnunet_web/ui.cljs
@@ -23,8 +23,17 @@
(let [data (.-data event)]
(if (= "stdout" (.-type data))
(set! (.-onmessage (.-port data))
- (fn [event] (output (.-data event))))
+ (fn [event] (output (str "peerinfo:" (.-data event)))))
(output (.-data event))))))
(.start (.-port peerinfo))
(.postMessage (.-port peerinfo) (clj->js {:type "stdout"}))
+
+(.addEventListener
+ (by-id :send)
+ "click"
+ (fn [event]
+ (let [message (js/Object.)]
+ (set! (.-type message) "message")
+ (set! (.-array message) (JSON/parse (.-value (by-id :message))))
+ (.postMessage (.-port peerinfo) message))))