Improved demo app code to better handle the IPFS storage connection based on the new EmbarkJS refactoring. The old code is stillcompatible with the refactored EmbarkJS code
This commit is contained in:
parent
c1f72ae10e
commit
4245d63bbb
|
@ -32,6 +32,9 @@ $(document).ready(function() {
|
|||
//EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'});
|
||||
|
||||
$("#storage .error").hide();
|
||||
EmbarkJS.Storage.setProvider('ipfs')
|
||||
.then(function(){
|
||||
console.log('Provider set to IPFS');
|
||||
EmbarkJS.Storage.ipfsConnection.ping()
|
||||
.then(function(){
|
||||
$("#status-storage").addClass('status-online');
|
||||
|
@ -45,6 +48,13 @@ $(document).ready(function() {
|
|||
$("#storage-controls").hide();
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(function(err){
|
||||
console.log('Failed to set IPFS as Provider:', err.message);
|
||||
$("#storage .error").show();
|
||||
$("#status-storage").addClass('status-offline');
|
||||
$("#storage-controls").hide();
|
||||
});
|
||||
|
||||
$("#storage button.setIpfsText").click(function() {
|
||||
var value = $("#storage input.ipfsText").val();
|
||||
|
|
Loading…
Reference in New Issue