add emitAndRunActionsForEvent

This commit is contained in:
Iuri Matias 2018-05-30 08:00:31 -04:00
parent 45f7767313
commit 4f20d31b4c
3 changed files with 7 additions and 4 deletions

View File

@ -192,8 +192,7 @@ class ContractDeployer {
});
},
function applyBeforeDeploy(next) {
self.events.emit('deploy:contract:beforeDeploy', {contract: contract});
self.plugins.runActionsForEvent('deploy:contract:beforeDeploy', {contract: contract}, next);
self.plugins.emitAndRunActionsForEvent('deploy:contract:beforeDeploy', {contract: contract}, next);
},
function createDeployObject(next) {
let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition});

View File

@ -104,8 +104,7 @@ class DeployManager {
});
},
function runAfterDeploy(callback) {
self.events.emit('contracts:deploy:afterAll');
self.plugins.runActionsForEvent('contracts:deploy:afterAll', callback);
self.plugins.emitAndRunActionsForEvent('contracts:deploy:afterAll', callback);
}
], function (err, _result) {
done(err);

View File

@ -138,4 +138,9 @@ Plugins.prototype.runActionsForEvent = function(eventName, args, cb) {
}, cb);
};
Plugins.prototype.emitAndRunActionsForEvent = function(eventName, args, cb) {
this.events.emit(eventName);
return this.runActionsForEvent(eventName, args, cb);
};
module.exports = Plugins;