Lifecycle methods are all the functions that components have that get called by the Gorilla system at specific times. You can add any of them to your component to implement custom behaviour at that point.
For example, there is a function called screenStart
which will be called when the screen starts. If you want to implement some of your own logic when the screen starts, you can add it to this function.
Use the menu on the left to browse the full list of lifecycle methods available to you.
Called when your component is first constructed.
Called after your component has been constructed, and all other components in the object's hierarchy have been constructed.
Called after your component has been initialised, and all other components in the object's hierarchy have been initialised.
Called when the screen starts
Called every frame, while this component is on the screen. Use this sparingly; it's necessary for e.g. click-and-drag handling or other operations that need to happen every frame, but most things do not.
Called when a response has been received as part of the response processing pipeline. Only called on ScreenComponents.
Called when a response has been received as part of the response processing pipeline. Only called on ScreenComponents.
Called when a response has been received as part of the response processing pipeline. Only called on ScreenComponents.
Called when a response has been received as part of the response processing pipeline. Only called on ScreenComponents.
Called when the screen is ready to advance because all responses have been received. This is the last moment where any additional responses can also be logged. If there is any feedback to still display before the end of the screen, it will continue to do so after this function is called, but otherwise the screen will finish on the same frame that this function is called.
This function also receives an array of promises - you can append your own promise to the array if you want to prevent the screen from advancing until you are ready:
Called when the screen has finished. After this is called, the elements on this screen will be hidden and the elements for the next screen will be shown, and screenStart() will be called for the next screen.
Called when your component is no longer on the screen. Use this to stop listening for any events that you wouldn't want to 'spill' over into the next screen.
Called when your component is about to be destroyed. Use this to release any resources you might have created, if necessary.