api tweak
This commit is contained in:
parent
7974c66515
commit
8c39a0716f
2 changed files with 13 additions and 12 deletions
23
js/lbry.js
23
js/lbry.js
|
@ -6,6 +6,15 @@ var lbry = {
|
|||
}
|
||||
};
|
||||
|
||||
lbry.call = function(method, params, callback)
|
||||
{
|
||||
/*
|
||||
* XHR magic
|
||||
*/
|
||||
//when XHR returns and is successful
|
||||
// callback(JSON.parse(xhr.responseText));
|
||||
}
|
||||
|
||||
//core
|
||||
lbry.connect = function(callback)
|
||||
{
|
||||
|
@ -16,24 +25,16 @@ lbry.connect = function(callback)
|
|||
}, 1500);
|
||||
}
|
||||
|
||||
lbry.getBalance = function()
|
||||
lbry.getBalance = function(callback)
|
||||
{
|
||||
var method = "get_balance";
|
||||
var request = new XmlRpcRequest("http://localhost:7080/", method);
|
||||
var amount = Number(request.send().parseXML());
|
||||
return amount;
|
||||
lbry.call("get_balance", {}, callback);
|
||||
}
|
||||
|
||||
lbry.search = function(query, callback)
|
||||
{
|
||||
//simulate searching via setTimeout with
|
||||
setTimeout(function() {
|
||||
var method = "search_nametrie"
|
||||
var request = new XmlRpcRequest("http://localhost:7080/", method);
|
||||
request.addParam(query);
|
||||
var results = request.send().parseXML();
|
||||
|
||||
callback(results);
|
||||
lbry.call("search_nametrie", { query: query }, callback);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
|
2
watch.sh
2
watch.sh
|
@ -11,5 +11,5 @@ if [ $1 != "jeremyisbadatnode" ]; then
|
|||
babel --presets es2015,react --out-dir dist/js/ --watch js/
|
||||
else
|
||||
#yes I am dumb, but not a high prio fix - Jeremy
|
||||
babel --presets /home/jeremy/local/lib/node_modules/babel-preset-es2015,/home/jeremy/local/lib/node_modules/babel-preset-react --out-dir dist/js/ --watch ~/code/lbry-web-gui/js/
|
||||
babel --presets /home/jeremy/local/lib/node_modules/babel-preset-es2015,/home/jeremy/local/lib/node_modules/babel-preset-react --out-dir dist/js/ --watch ~/code/lbry-web-ui/js/
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue