From 44d6cc32df6a1196f73b0146224840ce7f705bac Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 16 May 2018 13:56:23 -0400 Subject: [PATCH] remove old remove listener; fix callback --- lib/contracts/code_generator.js | 8 +++----- lib/contracts/contracts.js | 7 +++---- lib/pipeline/pipeline.js | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/contracts/code_generator.js b/lib/contracts/code_generator.js index 54b550a16..9ff898af9 100644 --- a/lib/contracts/code_generator.js +++ b/lib/contracts/code_generator.js @@ -101,11 +101,9 @@ class CodeGenerator { self.buildWeb3JS(cb); }); - this.events.removeListener('code-generator:contract', () => { - self.events.setCommandHandler('code-generator:contract', (contractName, cb) => { - let contract = self.contractsManager.contracts[contractName]; - self.buildContractJS(contractName, self.generateContractJSON(contractName, contract), cb); - }); + self.events.setCommandHandler('code-generator:contract', (contractName, cb) => { + let contract = self.contractsManager.contracts[contractName]; + self.buildContractJS(contractName, self.generateContractJSON(contractName, contract), cb); }); } diff --git a/lib/contracts/contracts.js b/lib/contracts/contracts.js index e76bdef86..6d0e5c1ad 100644 --- a/lib/contracts/contracts.js +++ b/lib/contracts/contracts.js @@ -27,10 +27,9 @@ class ContractsManager { }); const self = this; - this.events.removeListener('contracts:list', () => { - self.events.setCommandHandler('contracts:list', (cb) => { - cb(self.listContracts()); - }); + self.events.setCommandHandler('contracts:list', (cb) => { + console.dir('received request'); + cb(self.listContracts()); }); } diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index 2239f0eff..e12f3d724 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -3,6 +3,7 @@ const async = require('async'); const child_process = require('child_process'); const utils = require('../utils/utils.js'); const constants = require('../constants'); +//require("../utils/debug_util.js")(__filename, async); require("babel-preset-react"); require("babel-preset-es2015"); @@ -187,7 +188,7 @@ class Pipeline { self.events.request('contracts:list', (contracts) => { async.each(contracts, (contract, eachCb) => { fs.writeJson(fs.dappPath(this.buildDir, 'contracts', contract.className + ".json"), contract, {spaces: 2}, eachCb); - }, callback); + }, () => {callback()}); }); }); }