broccolijs / broccoli

Browser compilation library – an asset pipeline for applications that run in the browser
https://broccoli.build
MIT License
3.33k stars 217 forks source link

[feature] add a buildFinished event to builder #460

Closed gabrielcsapo closed 4 years ago

gabrielcsapo commented 4 years ago

Motivation

I am currently working on a project that requires knowing when a builder has finished without blocking on waiting on the current build.

This allows me to subscribe to events just like the beginNode and endNode events.

rwjblue commented 4 years ago

Isn't it possible to model this by chaining off of the existing promise? I don't really want to expose both a promise based interface and an evented one if we can help it... :thinking:

gabrielcsapo commented 4 years ago

@rwjblue this is wanting to listen to broccoli events without being the one to awaiting on the current build. How would I get the finished build if I didn’t want to block on waiting for the current build and knowing when the build started? Please see https://github.com/gabrielcsapo/broccoli-inspector/blob/master/server/index.js

gabrielcsapo commented 4 years ago
    watcher.on('buildSuccess', () => {
      socket.emit('buildFinished');
    });

this is exactly what I was looking for!