display error in case whisper is not available

This commit is contained in:
Iuri Matias 2017-01-26 19:18:53 -05:00
parent 27b2f33adc
commit 878b5aa2da
2 changed files with 10 additions and 1 deletions

View File

@ -75,6 +75,7 @@
</div>
<div role="tabpanel" class="tab-pane" id="communication">
<span class="error">The node you are using does not support whisper</span>
<h3>Listen To channel</h3>
<div class="form-group form-inline listen">

View File

@ -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();