aboutsummaryrefslogtreecommitdiffstats
path: root/lib/providermanager.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 04:22:05 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 04:22:05 +0800
commit08e26966275d5d0d7186bf734842e5da59a5bec9 (patch)
treea49e7fb0d5cf9ec06f85fb1d4da9a803ef66dfb6 /lib/providermanager.js
parentc9693b47467f16a6f35be6de85f57244b70d7a01 (diff)
downloaddexon-08e26966275d5d0d7186bf734842e5da59a5bec9.tar
dexon-08e26966275d5d0d7186bf734842e5da59a5bec9.tar.gz
dexon-08e26966275d5d0d7186bf734842e5da59a5bec9.tar.bz2
dexon-08e26966275d5d0d7186bf734842e5da59a5bec9.tar.lz
dexon-08e26966275d5d0d7186bf734842e5da59a5bec9.tar.xz
dexon-08e26966275d5d0d7186bf734842e5da59a5bec9.tar.zst
dexon-08e26966275d5d0d7186bf734842e5da59a5bec9.zip
removed send queues from providermanager
Diffstat (limited to 'lib/providermanager.js')
-rw-r--r--lib/providermanager.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/providermanager.js b/lib/providermanager.js
index 90e5ee409..c3b121451 100644
--- a/lib/providermanager.js
+++ b/lib/providermanager.js
@@ -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;