comply with linter

This commit is contained in:
Iuri Matias 2017-12-28 13:13:30 -05:00
parent 310712567f
commit fc24b04bf6
1 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,5 @@
/*global EmbarkJS, Web3 */
let __embarkWhisper = {};
__embarkWhisper.setProvider = function(options) {
@ -32,20 +34,21 @@ __embarkWhisper.setProvider = function(options) {
__embarkWhisper.web3CompatibleWithV5 = function() {
var _web3 = new Web3();
if (typeof(_web3.version) === "string") {
if ((typeof _web3.version) === "string") {
return true;
}
return parseInt(_web3.version.api.split('.')[1], 10) >= 20;
};
__embarkWhisper.getWhisperVersion = function(cb) {
const self = this;
if (EmbarkJS.isNewWeb3()) {
this.web3.shh.getVersion(function(err, version) {
cb(err, version);
});
} else {
this.web3.version.getWhisper(function(err, res) {
cb(err, web3.version.whisper);
this.web3.version.getWhisper(function(err, _res) {
cb(err, self.web3.version.whisper);
});
}
};
@ -88,7 +91,7 @@ __embarkWhisper.sendMessage = function(options) {
data = options.data || options.payload;
ttl = options.ttl || 100;
priority = options.priority || 1000;
var identity = options.identity || this.identity || web3.shh.newIdentity();
var identity = options.identity || this.identity || this.web3.shh.newIdentity();
var _topics;
if (topics === undefined) {