Skip to content

Commit

Permalink
Add a function reading the current block
Browse files Browse the repository at this point in the history
  • Loading branch information
FDubath committed Feb 16, 2021
1 parent 909c9cb commit b95733a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions jsc3l_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,29 @@ jsc3l_connection.testNode = function(api_address,callback) {
});
}

jsc3l_connection.getCurrentBlock = function(api_address, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', api_address + '/api.php', true);
xhr.responseType = 'json';
xhr.timeout = 5000;
xhr.onreadystatechange = function (oEvent) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
try{
var answer = xhr.response;
if(typeof answer =='object'){
answer = JSON.stringify(xhr.response);
}
callback(answer);
} catch(e){
}

}
}
};
xhr.send();
}


////////////////////////////////////////////////////////////////////////////////
var checkRepo = function(repoList, callback){
Expand Down

0 comments on commit b95733a

Please sign in to comment.