remove unneded assignments

This commit is contained in:
Iuri Matias 2018-07-07 21:23:51 +03:00
parent 9f05c43329
commit 8720f43e39
1 changed files with 7 additions and 13 deletions

View File

@ -6,16 +6,10 @@ const SwarmModule = require('../swarm');
class Storage { class Storage {
constructor(embark, options){ constructor(embark, options){
const self = this; const self = this;
this._embark = embark; this.embark = embark;
this._options = options; this.storageConfig = embark.config.storageConfig;
this._storageConfig = options.storageConfig;
this._webServerConfig = options.webServerConfig;
this._blockchainConfig = options.blockchainConfig;
this._servicesMonitor = options.servicesMonitor;
this._events = options.events;
this._logger = options.logger;
if (!this._storageConfig.enabled) return; if (!this.storageConfig.enabled) return;
this.addSetProviders(); this.addSetProviders();
@ -38,10 +32,10 @@ class Storage {
*/ */
addSetProviders() { addSetProviders() {
// filter list of dapp connections based on available_providers set in config // filter list of dapp connections based on available_providers set in config
let hasSwarm = _.contains(this._storageConfig.available_providers, 'swarm'); // don't need to eval this in every loop iteration let hasSwarm = _.contains(this.storageConfig.available_providers, 'swarm'); // don't need to eval this in every loop iteration
// contains valid dapp storage providers // contains valid dapp storage providers
this._validDappProviders = _.filter(this._storageConfig.dappConnection, (conn) => { this._validDappProviders = _.filter(this.storageConfig.dappConnection, (conn) => {
return _.contains(self._storageConfig.available_providers, conn.provider) || (conn === '$BZZ' && hasSwarm); return _.contains(self.storageConfig.available_providers, conn.provider) || (conn === '$BZZ' && hasSwarm);
}); });
let code = `\nEmbarkJS.Storage.setProviders(${JSON.stringify(this._validDappProviders)});`; let code = `\nEmbarkJS.Storage.setProviders(${JSON.stringify(this._validDappProviders)});`;
@ -49,7 +43,7 @@ class Storage {
return (this._validDappProviders !== undefined && this._validDappProviders.length > 0 && storageConfig.enabled === true); return (this._validDappProviders !== undefined && this._validDappProviders.length > 0 && storageConfig.enabled === true);
}; };
this._embark.addProviderInit('storage', code, shouldInit); this.embark.addProviderInit('storage', code, shouldInit);
} }
} }