From ce781ab96ebd60bc2590c44e41e3d55449a41aa7 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 16 May 2018 13:11:44 -0400 Subject: [PATCH] remove previous listener (for now) --- lib/contracts/code_generator.js | 8 +++++--- lib/contracts/contracts.js | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/contracts/code_generator.js b/lib/contracts/code_generator.js index 2a4e80190..54b550a16 100644 --- a/lib/contracts/code_generator.js +++ b/lib/contracts/code_generator.js @@ -101,9 +101,11 @@ class CodeGenerator { self.buildWeb3JS(cb); }); - this.events.setCommandHandler('code-generator:contract', (contractName, cb) => { - let contract = self.contractsManager.contracts[contractName]; - self.buildContractJS(contractName, self.generateContractJSON(contractName, contract), 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); + }); }); } diff --git a/lib/contracts/contracts.js b/lib/contracts/contracts.js index 81b5ed37b..e76bdef86 100644 --- a/lib/contracts/contracts.js +++ b/lib/contracts/contracts.js @@ -27,8 +27,10 @@ class ContractsManager { }); const self = this; - this.events.setCommandHandler('contracts:list', (cb) => { - cb(self.listContracts()); + this.events.removeListener('contracts:list', () => { + self.events.setCommandHandler('contracts:list', (cb) => { + cb(self.listContracts()); + }); }); }