remove old remove listener; fix callback

This commit is contained in:
Iuri Matias 2018-05-16 13:56:23 -04:00
parent ce781ab96e
commit 44d6cc32df
3 changed files with 8 additions and 10 deletions

View File

@ -101,11 +101,9 @@ class CodeGenerator {
self.buildWeb3JS(cb); self.buildWeb3JS(cb);
}); });
this.events.removeListener('code-generator:contract', () => { self.events.setCommandHandler('code-generator:contract', (contractName, cb) => {
self.events.setCommandHandler('code-generator:contract', (contractName, cb) => { let contract = self.contractsManager.contracts[contractName];
let contract = self.contractsManager.contracts[contractName]; self.buildContractJS(contractName, self.generateContractJSON(contractName, contract), cb);
self.buildContractJS(contractName, self.generateContractJSON(contractName, contract), cb);
});
}); });
} }

View File

@ -27,10 +27,9 @@ class ContractsManager {
}); });
const self = this; const self = this;
this.events.removeListener('contracts:list', () => { self.events.setCommandHandler('contracts:list', (cb) => {
self.events.setCommandHandler('contracts:list', (cb) => { console.dir('received request');
cb(self.listContracts()); cb(self.listContracts());
});
}); });
} }

View File

@ -3,6 +3,7 @@ const async = require('async');
const child_process = require('child_process'); const child_process = require('child_process');
const utils = require('../utils/utils.js'); const utils = require('../utils/utils.js');
const constants = require('../constants'); const constants = require('../constants');
//require("../utils/debug_util.js")(__filename, async);
require("babel-preset-react"); require("babel-preset-react");
require("babel-preset-es2015"); require("babel-preset-es2015");
@ -187,7 +188,7 @@ class Pipeline {
self.events.request('contracts:list', (contracts) => { self.events.request('contracts:list', (contracts) => {
async.each(contracts, (contract, eachCb) => { async.each(contracts, (contract, eachCb) => {
fs.writeJson(fs.dappPath(this.buildDir, 'contracts', contract.className + ".json"), contract, {spaces: 2}, eachCb); fs.writeJson(fs.dappPath(this.buildDir, 'contracts', contract.className + ".json"), contract, {spaces: 2}, eachCb);
}, callback); }, () => {callback()});
}); });
}); });
} }