From 507241f73ce1eadc2a0072999a06ffa0246eb1ba Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Mon, 12 Jan 2015 18:34:37 +0100 Subject: shh getMessage => getMessages --- lib/web3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/web3.js b/lib/web3.js index 9a85c4d1b..2fe414259 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -150,7 +150,7 @@ var shhWatchMethods = function () { return [ { name: 'newFilter', call: 'shh_newFilter' }, { name: 'uninstallFilter', call: 'shh_uninstallFilter' }, - { name: 'getMessage', call: 'shh_getMessages' } + { name: 'getMessages', call: 'shh_getMessages' } ]; }; -- cgit v1.2.3 From e97478cc1e252f8963552028ff34a3bc3bdacd63 Mon Sep 17 00:00:00 2001 From: aaron Date: Fri, 16 Jan 2015 16:03:13 -0800 Subject: WebsocketProvider - fixed incorrect variable name --- lib/websocket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/websocket.js b/lib/websocket.js index 5b40075e4..6d61d35d6 100644 --- a/lib/websocket.js +++ b/lib/websocket.js @@ -71,7 +71,7 @@ WebSocketProvider.prototype.unload = function() { this.ws.close(); }; Object.defineProperty(WebSocketProvider.prototype, "onmessage", { - set: function(provider) { this.onMessage(provider); } + set: function(handler) { this.onMessage(handler); } }); if (typeof(module) !== "undefined") -- cgit v1.2.3 From 063f69d51d6a8a703d2f4a4eadcbb3c35f870c91 Mon Sep 17 00:00:00 2001 From: wanderer Date: Sat, 24 Jan 2015 19:32:26 -0500 Subject: added local --- lib/local.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/local.js (limited to 'lib') diff --git a/lib/local.js b/lib/local.js new file mode 100644 index 000000000..30cd14df2 --- /dev/null +++ b/lib/local.js @@ -0,0 +1,18 @@ +var addressName = {"0x12378912345789": "Gav", "0x57835893478594739854": "Jeff"}; +var nameAddress = {}; + +for (var prop in addressName) { + if (addressName.hasOwnProperty(prop)) { + nameAddress[addressName[prop]] = prop; + } +} + +var local = { + addressBook:{ + byName: addressName, + byAddress: nameAddress + } +}; + +if (typeof(module) !== "undefined") + module.exports = local; -- cgit v1.2.3 From fa93480d9aadf16698dd3a4439e1870dcb61b5cc Mon Sep 17 00:00:00 2001 From: wanderer Date: Sat, 24 Jan 2015 19:45:53 -0500 Subject: added addressbook --- lib/local.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/local.js (limited to 'lib') diff --git a/lib/local.js b/lib/local.js new file mode 100644 index 000000000..30cd14df2 --- /dev/null +++ b/lib/local.js @@ -0,0 +1,18 @@ +var addressName = {"0x12378912345789": "Gav", "0x57835893478594739854": "Jeff"}; +var nameAddress = {}; + +for (var prop in addressName) { + if (addressName.hasOwnProperty(prop)) { + nameAddress[addressName[prop]] = prop; + } +} + +var local = { + addressBook:{ + byName: addressName, + byAddress: nameAddress + } +}; + +if (typeof(module) !== "undefined") + module.exports = local; -- cgit v1.2.3 From d0b6f3663b70c325eb0d1474c3c5df51e53c2cee Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 26 Jan 2015 16:22:40 +0100 Subject: watches are calling callback with a single result object, not a full jsonrpc response --- lib/filter.js | 6 ++++-- lib/providermanager.js | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/filter.js b/lib/filter.js index 079c25049..8c7dc6e33 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -47,8 +47,10 @@ Filter.prototype.changed = function(callback) { /// trigger calling new message from people Filter.prototype.trigger = function(messages) { - for(var i = 0; i < this.callbacks.length; i++) { - this.callbacks[i].call(this, messages); + for (var i = 0; i < this.callbacks.length; i++) { + for (var j = 0; j < messages; j++) { + this.callbacks[i].call(this, messages[j]); + } } }; diff --git a/lib/providermanager.js b/lib/providermanager.js index 83e11605b..a00f444a1 100644 --- a/lib/providermanager.js +++ b/lib/providermanager.js @@ -49,12 +49,12 @@ var ProviderManager = function() { result = JSON.parse(result); - // dont call the callback if result is an error, empty array or false - if (result.error || (result.result instanceof Array ? result.result.length === 0 : !result.result)) { + // dont call the callback if result is not an array, or empty one + if (result.error || !(result.result instanceof Array) || result.result.length === 0) { return; } - data.callback(result); + data.callback(result.result); }); } setTimeout(poll, 12000); -- cgit v1.2.3 From e5d294df327d817bbe66764fba596e77d2a66b7b Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 26 Jan 2015 16:41:00 +0100 Subject: return null instead of undefined, if not provider is set --- lib/providermanager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/providermanager.js b/lib/providermanager.js index a00f444a1..025ade355 100644 --- a/lib/providermanager.js +++ b/lib/providermanager.js @@ -70,7 +70,7 @@ ProviderManager.prototype.send = function(data) { if (this.provider === undefined) { console.error('provider is not set'); - return undefined; + return null; } //TODO: handle error here? -- cgit v1.2.3 From 7807a4f738ac6d8d7a1f15decb5320502a19a48c Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 26 Jan 2015 16:42:29 +0100 Subject: polling every second --- lib/providermanager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/providermanager.js b/lib/providermanager.js index 025ade355..1a550e5f4 100644 --- a/lib/providermanager.js +++ b/lib/providermanager.js @@ -57,7 +57,7 @@ var ProviderManager = function() { data.callback(result.result); }); } - setTimeout(poll, 12000); + setTimeout(poll, 1000); }; poll(); }; -- cgit v1.2.3 From da4c2d530d6f9b8ba54221c6812f77766a33fed6 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 27 Jan 2015 00:54:21 +0100 Subject: removed promise dependency, updated readme, fixed node.js version of lib --- lib/httpsync.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/httpsync.js b/lib/httpsync.js index 67a3988f9..a638cfe94 100644 --- a/lib/httpsync.js +++ b/lib/httpsync.js @@ -21,6 +21,10 @@ * @date 2014 */ +if (process.env.NODE_ENV !== 'build') { + var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line +} + var HttpSyncProvider = function (host) { this.handlers = []; this.host = host || 'http://localhost:8080'; -- cgit v1.2.3