From cb607b4911711501a8e70db0fe2148c51272c719 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 29 Oct 2014 17:14:59 +0100 Subject: [PATCH] changes to make whisper working --- httprpc.js | 2 +- main.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/httprpc.js b/httprpc.js index 8e3c74b8b2..085b4693d4 100644 --- a/httprpc.js +++ b/httprpc.js @@ -48,7 +48,7 @@ var self = this; this.sendRequest(payload, function (request) { var parsed = JSON.parse(request.responseText); - if (!parsed.result) { + if (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result) { return; } self.handlers.forEach(function (handler) { diff --git a/main.js b/main.js index 32064ce26d..cc85b98501 100644 --- a/main.js +++ b/main.js @@ -131,11 +131,11 @@ }).then(function (request) { return new Promise(function (resolve, reject) { web3.provider.send(request, function (result) { - if (result) { + if (result || typeof result === "boolean") { resolve(result); - } else { - reject(result); - } + return; + } + reject(result); }); }); }).catch(function( err) { @@ -373,6 +373,10 @@ }); }; + Filter.prototype.arrived = function(callback) { + this.changed(callback); + } + Filter.prototype.changed = function(callback) { var self = this; this.promise.then(function(id) {