From 878b5aa2da76c25cf9af232caa9c2efc5c5aa8ea Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 26 Jan 2017 19:18:53 -0500 Subject: [PATCH] display error in case whisper is not available --- demo/app/index.html | 1 + demo/app/js/index.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/demo/app/index.html b/demo/app/index.html index af92acbb2..417f60960 100644 --- a/demo/app/index.html +++ b/demo/app/index.html @@ -75,6 +75,7 @@
+ The node you are using does not support whisper

Listen To channel

diff --git a/demo/app/js/index.js b/demo/app/js/index.js index aa40e01fa..e5a1ebe6b 100644 --- a/demo/app/js/index.js +++ b/demo/app/js/index.js @@ -71,7 +71,15 @@ $(document).ready(function() { // Communication (Whisper) example // =========================== $(document).ready(function() { - EmbarkJS.Messages.setProvider('whisper'); + + $("#communication .error").hide(); + web3.version.getWhisper(function(err, res) { + if (err) { + $("#communication .error").show(); + } else { + EmbarkJS.Messages.setProvider('whisper'); + } + }); $("#communication button.listenToChannel").click(function() { var channel = $("#communication .listen input.channel").val();