diff --git a/demo/app/index.html b/demo/app/index.html index 6544e05d..9dcde044 100644 --- a/demo/app/index.html +++ b/demo/app/index.html @@ -9,8 +9,8 @@
@@ -37,7 +37,8 @@
- note: You need to have an IPFS node running + +

Save text to IPFS

@@ -72,10 +73,10 @@

EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'})
- +
- +

Listen To channel

diff --git a/demo/app/js/index.js b/demo/app/js/index.js index 60147b1b..c430bbf9 100644 --- a/demo/app/js/index.js +++ b/demo/app/js/index.js @@ -30,6 +30,21 @@ $(document).ready(function() { $(document).ready(function() { EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'}); + $("#storage .error").hide(); + EmbarkJS.Storage.ipfsConnection.ping() + .then(function(){ + $("#status-storage").addClass('status-online'); + $("#storage-controls").show(); + }) + .catch(function(err) { + if(err){ + console.log("IPFS Connection Error => " + err.message); + $("#storage .error").show(); + $("#status-storage").addClass('status-offline'); + $("#storage-controls").hide(); + } + }); + $("#storage button.setIpfsText").click(function() { var value = $("#storage input.ipfsText").val(); EmbarkJS.Storage.saveText(value).then(function(hash) {