Skip to content

Commit

Permalink
Merge pull request #6 from frewsxcv/master
Browse files Browse the repository at this point in the history
Run JSHint on all code using Travis CI
  • Loading branch information
obscuren committed Nov 14, 2014
2 parents e84fa8d + e3998e3 commit c966a5c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "0.11"
install:
- "npm install jshint"
script:
- "jshint *.js"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ethereum JavaScript API

[![Build Status](https://travis-ci.org/ethereum/ethereum.js.svg?branch=master)](https://travis-ci.org/ethereum/ethereum.js)

This is the Ethereum compatible JavaScript API using `Promise`s
which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec.

Expand Down
8 changes: 4 additions & 4 deletions httprpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
method: object.call,
params: object.args,
id: object._id
}
};
};
}

function formatJsonRpcMessage(message) {
var object = JSON.parse(message);
Expand All @@ -20,7 +20,7 @@
_id: object.id,
data: object.result
};
};
}

HttpRpcProvider.prototype.sendRequest = function (payload, cb) {
var data = formatJsonRpcObject(payload);
Expand All @@ -32,7 +32,7 @@
if (request.readyState === 4 && cb) {
cb(request);
}
}
};
};

HttpRpcProvider.prototype.send = function (payload) {
Expand Down
26 changes: 11 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function(window) {
function isPromise(o) {
return o instanceof Promise
return o instanceof Promise;
}

function flattenPromise (obj) {
Expand Down Expand Up @@ -40,7 +40,7 @@
}

return Promise.resolve(obj);
};
}

var ethMethods = function () {
var blockCall = function (args) {
Expand Down Expand Up @@ -171,7 +171,7 @@
}).catch(function (err) {
console.error(err);
});
}
};
}
Object.defineProperty(obj, property.name, proto);
});
Expand All @@ -196,8 +196,8 @@
var str = "";
var i = 0, l = hex.length;
for(; i < l; i+=2) {
var code = hex.charCodeAt(i)
if(code == 0) {
var code = hex.charCodeAt(i);
if(code === 0) {
break;
}

Expand All @@ -216,22 +216,18 @@
var hex = this.toHex(str);
while(hex.length < pad*2)
hex += "00";
return hex
return hex;
},

eth: {
prototype: Object(),
watch: function (params) {
return new Filter(params, ethWatch);
},
},

db: {
prototype: Object()
},
db: {},

shh: {
prototype: Object(),
watch: function (params) {
return new Filter(params, shhWatch);
}
Expand All @@ -243,15 +239,15 @@
}

web3._events[event][id] = cb;
return this
return this;
},

off: function(event, id) {
if(web3._events[event] !== undefined) {
delete web3._events[event][id];
}

return this
return this;
},

trigger: function(event, id, data) {
Expand Down Expand Up @@ -376,7 +372,7 @@

Filter.prototype.arrived = function(callback) {
this.changed(callback);
}
};

Filter.prototype.changed = function(callback) {
var self = this;
Expand Down Expand Up @@ -416,7 +412,7 @@
if(data._id) {
var cb = web3._callbacks[data._id];
if (cb) {
cb.call(this, data.data)
cb.call(this, data.data);
delete web3._callbacks[data._id];
}
}
Expand Down
2 changes: 1 addition & 1 deletion qt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
self.handlers.forEach(function (handler) {
handler.call(self, JSON.parse(message.data));
});
}
};
};

QtProvider.prototype.send = function(payload) {
Expand Down
2 changes: 1 addition & 1 deletion websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var self = this;
this.ws.onmessage = function(event) {
for(var i = 0; i < self.handlers.length; i++) {
self.handlers[i].call(self, JSON.parse(event.data), event)
self.handlers[i].call(self, JSON.parse(event.data), event);
}
};

Expand Down

0 comments on commit c966a5c

Please sign in to comment.