From 1c561373a2278fd5440b1ecbf24b1fd9902bbe05 Mon Sep 17 00:00:00 2001 From: Luca Heft Date: Thu, 27 Nov 2025 11:30:19 +0100 Subject: [PATCH 1/3] Add init and configure event to AppBase --- src/framework/app-base.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/framework/app-base.js b/src/framework/app-base.js index 077bdedf9f2..a86c05bc3b8 100644 --- a/src/framework/app-base.js +++ b/src/framework/app-base.js @@ -588,6 +588,8 @@ class AppBase extends EventHandler { // bind tick function to current scope /* eslint-disable-next-line no-use-before-define */ this.tick = makeTick(this); // Circular linting issue as makeTick and Application reference each other + + this.fire('init'); } static _applications = {}; @@ -690,6 +692,7 @@ class AppBase extends EventHandler { this._parseScenes(scenes); this._parseAssets(assets); if (!err) { + this.fire('configure'); callback(null); } else { callback(err); From af2754f597acae294bd6f10e883de921212a9b62 Mon Sep 17 00:00:00 2001 From: Luca Heft Date: Thu, 27 Nov 2025 12:16:52 +0100 Subject: [PATCH 2/3] Add jsdoc for events --- src/framework/app-base.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/framework/app-base.js b/src/framework/app-base.js index 5eef4d9feb6..8fd78826c92 100644 --- a/src/framework/app-base.js +++ b/src/framework/app-base.js @@ -125,6 +125,28 @@ let app = null; * your application. */ class AppBase extends EventHandler { + /** + * Fired after the app is initialized. + * + * @event + * @example + * app.on('init', () => { + * console.log(`App initialized`); + * }); + */ + static EVENT_INIT = 'init'; + + /** + * Fired after the app is configured. + * + * @event + * @example + * app.on('configure', () => { + * console.log(`App configured`); + * }); + */ + static EVENT_CONFIGURE = 'configure'; + /** * The application's batch manager. * From 7efa0013b9c49464b396a327c870d3c6a53d8573 Mon Sep 17 00:00:00 2001 From: Luca Heft Date: Thu, 27 Nov 2025 15:26:52 +0100 Subject: [PATCH 3/3] Rename configure event to config:loaded, adjust event doc --- src/framework/app-base.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/framework/app-base.js b/src/framework/app-base.js index 8fd78826c92..f5452ff1e19 100644 --- a/src/framework/app-base.js +++ b/src/framework/app-base.js @@ -137,15 +137,15 @@ class AppBase extends EventHandler { static EVENT_INIT = 'init'; /** - * Fired after the app is configured. + * Fired after an app configuration file was loaded. * * @event * @example - * app.on('configure', () => { - * console.log(`App configured`); + * app.on('config:loaded', () => { + * console.log(`App config loaded`); * }); */ - static EVENT_CONFIGURE = 'configure'; + static EVENT_CONFIGURE = 'config:loaded'; /** * The application's batch manager. @@ -714,7 +714,7 @@ class AppBase extends EventHandler { this._parseScenes(scenes); this._parseAssets(assets); if (!err) { - this.fire('configure'); + this.fire('config:loaded'); callback(null); } else { callback(err);