There are two limitations in the current broadway
implementation which this proposal intends to address:
- Events emitted by
broadway.App
instances are not granular enough. Currently only these events are emitted:init
: Emitted when the App has completed initialization.['plugin', name, 'init']
: Emitted when a given plugin has completed initialization.['plugin', name, 'error']
: Emitted when there was an error initializing the given plugin.['broadway', 'logged']
: Emitted when the application has logged a given message
- It is not possible to run a specified function before or after a given plugin method or other broadway action. The need for this has become clear refactoring
jitsu
to useflatiron
. These hooks need to support async actions as well as sync actions.
- Standardize and increase the number of events emitted by
broadway.App
instances: - Implement before and after hooks similar to
resourceful
.
var app = new broadway.App();
app.before('start', function (callback) {
doSomethingAsync(callback);
});
1 can be done and straight forward and I think it's a good idea.
2 can be done by first loading @jesusabdullah's hook plugin.