Skip to content

Commit

Permalink
Modify async to allow for children to start before onStart
Browse files Browse the repository at this point in the history
A recent fix had children starting prior to the async hook.
  • Loading branch information
paulfalgout committed Aug 7, 2018
1 parent 0d6e159 commit ce28e29
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/app.js
Expand Up @@ -189,9 +189,7 @@ const App = Application.extend({

this._bindRunningEvents();

this._startChildApps();

this.triggerStart(options);
this.finallyStart(options);

return this;
},
Expand Down Expand Up @@ -236,19 +234,33 @@ const App = Application.extend({
return this;
},

/**
* Starts children and triggers start event
* For calling within `finallyStart`
*
* @public
* @method triggerStart
* @memberOf App
* @event App#start - passes any arguments
* @returns
*/
triggerStart() {
this._startChildApps();
this.triggerMethod('start', ...arguments);
},

/**
* Triggers start event.
* Override to introduce async start
*
* @public
* @method triggerStart
* @method finallyStart
* @memberOf App
* @param {Object} [options] - Settings for the App passed through to events
* @event App#start - passes options
* @returns
*/
triggerStart(options) {
this.triggerMethod('start', options);
finallyStart(options) {
this.triggerStart(options);
},

/**
Expand Down

0 comments on commit ce28e29

Please sign in to comment.