From ce28e29f859070a4143c9aae00e901c1afcfc50e Mon Sep 17 00:00:00 2001 From: Paul Falgout Date: Thu, 21 Jun 2018 10:05:17 -0500 Subject: [PATCH] Modify async to allow for children to start before onStart A recent fix had children starting prior to the async hook. --- src/app.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/app.js b/src/app.js index 1559f33..5b910f3 100644 --- a/src/app.js +++ b/src/app.js @@ -189,9 +189,7 @@ const App = Application.extend({ this._bindRunningEvents(); - this._startChildApps(); - - this.triggerStart(options); + this.finallyStart(options); return this; }, @@ -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); }, /**