Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/framework/app-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 an app configuration file was loaded.
*
* @event
* @example
* app.on('config:loaded', () => {
* console.log(`App config loaded`);
* });
*/
static EVENT_CONFIGURE = 'config:loaded';

/**
* The application's batch manager.
*
Expand Down Expand Up @@ -588,6 +610,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 = {};
Expand Down Expand Up @@ -690,6 +714,7 @@ class AppBase extends EventHandler {
this._parseScenes(scenes);
this._parseAssets(assets);
if (!err) {
this.fire('config:loaded');
callback(null);
} else {
callback(err);
Expand Down