http sync api

This commit is contained in:
Marek Kotewicz
2015-01-21 20:29:02 +01:00
parent e1fcffcc81
commit 0d2cccc2ce
8 changed files with 286 additions and 102 deletions

View File

@ -56,21 +56,17 @@ var ProviderManager = function() {
};
/// sends outgoing requests, if provider is not available, enqueue the request
ProviderManager.prototype.send = function(data, cb) {
ProviderManager.prototype.send = function(data) {
data._id = this.id;
if (cb) {
web3._callbacks[data._id] = cb;
}
data.args = data.args || [];
this.id++;
if(this.provider !== undefined) {
this.provider.send(data);
} else {
console.warn("provider is not set");
this.queued.push(data);
if (this.provider === undefined) {
console.error("provider is not set");
}
return this.provider.send(data);
};
/// setups provider, which will be used for sending messages