removed send queues from providermanager
This commit is contained in:
@ -57,17 +57,19 @@ var ProviderManager = function() {
|
||||
|
||||
/// sends outgoing requests, if provider is not available, enqueue the request
|
||||
ProviderManager.prototype.send = function(data) {
|
||||
data._id = this.id;
|
||||
|
||||
data.args = data.args || [];
|
||||
this.id++;
|
||||
data._id = this.id++;
|
||||
|
||||
if (this.provider === undefined) {
|
||||
console.error('provider is not set');
|
||||
return JSON.stringify({result: 'error, provider is not set'});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.provider.send(data);
|
||||
//TODO: handle error here?
|
||||
var result = this.provider.send(data);
|
||||
result = JSON.parse(result);
|
||||
return result.result;
|
||||
};
|
||||
|
||||
/// setups provider, which will be used for sending messages
|
||||
@ -80,14 +82,6 @@ ProviderManager.prototype.set = function(provider) {
|
||||
this.ready = true;
|
||||
};
|
||||
|
||||
/// resends queued messages
|
||||
ProviderManager.prototype.sendQueued = function() {
|
||||
for(var i = 0; this.queued.length; i++) {
|
||||
// Resend
|
||||
this.send(this.queued[i]);
|
||||
}
|
||||
};
|
||||
|
||||
/// @returns true if the provider i properly set
|
||||
ProviderManager.prototype.installed = function() {
|
||||
return this.provider !== undefined;
|
||||
|
Reference in New Issue
Block a user