From 8325943bd791323006ff5decd6c34f3e1faf46e6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 5 Mar 2017 11:00:47 -0500 Subject: [PATCH] add new events for output generation and first deployment --- docs/plugins.rst | 3 +++ lib/core/engine.js | 2 ++ lib/index.js | 1 + 3 files changed, 6 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index 10cb3e0d..99f8d084 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -277,6 +277,9 @@ This call is used to listen and react to events that happen in Embark such as co a file change, args is (filetype, path) * "abi", "abi-vanila", "abi-contracts-vanila" - triggered when contracts have been deployed and returns the generated JS code + * "outputDone" - triggered when dapp is (re)generated + * "firstDeploymentDone" - triggered when the dapp is deployed and generated + for the first time .. code:: javascript diff --git a/lib/core/engine.js b/lib/core/engine.js index 582f615b..a0f711ed 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -74,11 +74,13 @@ Engine.prototype.pipelineService = function(options) { this.events.on('abi', function(abi) { self.currentAbi = abi; pipeline.build(abi); + self.events.emit('outputDone'); }); this.events.on('file-event', function(fileType, path) { if (fileType === 'asset') { self.config.reloadConfig(); pipeline.build(self.abi, path); + self.events.emit('outputDone'); } }); }; diff --git a/lib/index.js b/lib/index.js index 7964c56b..1f442267 100644 --- a/lib/index.js +++ b/lib/index.js @@ -127,6 +127,7 @@ var Embark = { engine.logger.setStatus("Ready".green); engine.logger.info("Looking for documentation? you can find it at ".cyan + "http://embark.readthedocs.io/".green.underline); engine.logger.info("Ready".underline); + engine.events.emit('firstDeploymentDone'); } }); },