-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add init and configure event to AppBase #8188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
mvaligursky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How strange the events are not documented. I'll put on my list to document.
Please document yours though - see how these are done:
Lines 32 to 81 in 25effe0
| class Scene extends EventHandler { | |
| /** | |
| * Fired when the layer composition is set. Use this event to add callbacks or advanced | |
| * properties to your layers. The handler is passed the old and the new | |
| * {@link LayerComposition}. | |
| * | |
| * @event | |
| * @example | |
| * app.scene.on('set:layers', (oldComp, newComp) => { | |
| * const list = newComp.layerList; | |
| * for (let i = 0; i < list.length; i++) { | |
| * const layer = list[i]; | |
| * switch (layer.name) { | |
| * case 'MyLayer': | |
| * layer.onEnable = myOnEnableFunction; | |
| * layer.onDisable = myOnDisableFunction; | |
| * break; | |
| * case 'MyOtherLayer': | |
| * layer.clearColorBuffer = true; | |
| * break; | |
| * } | |
| * } | |
| * }); | |
| */ | |
| static EVENT_SETLAYERS = 'set:layers'; | |
| /** | |
| * Fired when the skybox is set. The handler is passed the {@link Texture} that is the | |
| * previously used skybox cubemap texture. The new skybox cubemap texture is in the | |
| * {@link Scene#skybox} property. | |
| * | |
| * @event | |
| * @example | |
| * app.scene.on('set:skybox', (oldSkybox) => { | |
| * console.log(`Skybox changed from ${oldSkybox.name} to ${app.scene.skybox.name}`); | |
| * }); | |
| */ | |
| static EVENT_SETSKYBOX = 'set:skybox'; | |
| /** | |
| * Fired before the camera renders the scene. The handler is passed the {@link CameraComponent} | |
| * that will render the scene. | |
| * | |
| * @event | |
| * @example | |
| * app.scene.on('prerender', (camera) => { | |
| * console.log(`Camera ${camera.entity.name} will render the scene`); | |
| * }); | |
| */ | |
| static EVENT_PRERENDER = 'prerender'; |
|
|
|
I see, not sure how to go forward with this. How about we only add init event for now? |
I think if you name second event as |
|
I just tried this out and it seems like when launching in the editor (use_local_engine), these events are not called. However when downloading they work correctly. I guess there is some custom editor startup which doesn't call init and configure of the AppBase? In my test I subscribed to the events in the loadingscreen |
Description
Adds 2 new generic events to AppBase
init -> Fired after AppBase.init
configure -> Fired after successfull AppBase.configure
I've noticed, that there are no jsdocs for events in AppBase, if desired I can add those as well
If this gets merged we also want to reflect these changes on the developer site Application Lifecycle
Checklist