fix jshint issues

This commit is contained in:
Iuri Matias 2017-10-09 09:11:37 -04:00
parent 09db4eaa53
commit 2f25876722
2 changed files with 26 additions and 25 deletions

View File

@ -18,6 +18,7 @@ EmbarkJS.isNewWeb3 = function() {
EmbarkJS.Contract = function(options) {
var self = this;
var i, abiElement;
var ContractClass;
this.abi = options.abi;
this.address = options.address;
@ -28,14 +29,12 @@ EmbarkJS.Contract = function(options) {
// TODO:
// add default **from** address
// add gasPrice
var ContractClass = new this.web3.eth.Contract(this.abi, this.address);
ContractClass = new this.web3.eth.Contract(this.abi, this.address);
ContractClass.setProvider(this.web3.currentProvider);
return ContractClass;
} else {
var ContractClass = this.web3.eth.contract(this.abi);
ContractClass = this.web3.eth.contract(this.abi);
this.eventList = [];
@ -362,7 +361,7 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
var self = this;
var ipfs;
if (provider === 'whisper') {
this.providerName = 'whisper'
this.providerName = 'whisper';
this.currentMessages = EmbarkJS.Messages.Whisper;
let provider;
if (options === undefined) {
@ -391,7 +390,7 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
self.currentMessages.whisperVersion = self.currentMessages.web3.version.whisper;
});
} else if (provider === 'orbit') {
this.providerName = 'orbit'
this.providerName = 'orbit';
this.currentMessages = EmbarkJS.Messages.Orbit;
if (options === undefined) {
ipfs = HaadIpfsApi('localhost', '5001');
@ -420,11 +419,12 @@ EmbarkJS.Messages.listenTo = function(options) {
EmbarkJS.Messages.Whisper = {};
EmbarkJS.Messages.Whisper.sendMessage = function(options) {
var topics, data, ttl, priority, payload;
if (EmbarkJS.Messages.isNewWeb3()) {
var topics = options.topic || options.topics;
var data = options.data || options.payload;
var ttl = options.ttl || 100;
var priority = options.priority || 1000;
topics = options.topic || options.topics;
data = options.data || options.payload;
ttl = options.ttl || 100;
priority = options.priority || 1000;
var powTime = options.powTime || 3;
var powTarget = options.powTarget || 0.5;
@ -438,7 +438,7 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
topics = this.web3.utils.toHex(topics).slice(0, 10);
var payload = JSON.stringify(data);
payload = JSON.stringify(data);
let message = {
symKeyID: this.symKeyID, // encrypts using the sym key ID
@ -452,11 +452,11 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
this.web3.shh.post(message, function() { });
} else {
var topics = options.topic || options.topics;
var data = options.data || options.payload;
topics = options.topic || options.topics;
data = options.data || options.payload;
ttl = options.ttl || 100;
priority = options.priority || 1000;
var identity = options.identity || this.identity || web3.shh.newIdentity();
var ttl = options.ttl || 100;
var priority = options.priority || 1000;
var _topics;
if (topics === undefined) {
@ -474,7 +474,7 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
}
topics = _topics;
var payload = JSON.stringify(data);
payload = JSON.stringify(data);
var message;
message = {
@ -485,13 +485,14 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
priority: priority
};
return EmbarkJS.Messages.currentMessages.web3.shh.post(message, function() { console.log("message sent") });
return EmbarkJS.Messages.currentMessages.web3.shh.post(message, function() { });
}
};
EmbarkJS.Messages.Whisper.listenTo = function(options) {
var topics, _topics, messageEvents;
if (EmbarkJS.Messages.isNewWeb3()) {
var messageEvents = function() {
messageEvents = function() {
this.cb = function() {};
};
@ -507,8 +508,8 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
this.filter.stopWatching();
};
var topics = options.topic || options.topics;
var _topics = [];
topics = options.topic || options.topics;
_topics = [];
let promise = new messageEvents();
@ -539,10 +540,10 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
return promise;
} else {
var topics = options.topic || options.topics;
var _topics = [];
topics = options.topic || options.topics;
_topics = [];
var messageEvents = function() {
messageEvents = function() {
this.cb = function() {};
};
@ -591,7 +592,7 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
return promise;
}
}
};
EmbarkJS.Messages.Orbit = {};

View File

@ -142,7 +142,7 @@ result += "\n";
connectionCode += '\n\tweb3 = new Web3(web3.currentProvider);';
connectionCode += "\n } else if (value !== '$WEB3' && (typeof Web3 !== 'undefined' && ((typeof web3 === 'undefined') || (typeof web3 !== 'undefined' && (!web3.isConnected || (web3.isConnected && !web3.isConnected())))))) {";
connectionCode += "\n\tweb3 = new Web3(new Web3.providers.HttpProvider(value));"
connectionCode += "\n\tweb3 = new Web3(new Web3.providers.HttpProvider(value));";
connectionCode += "\n}";