The Life Cycle#
Components have a life cycle. Instead of several events, there is just one method you must override (or ignore if not needed):
lifeCycle(cycle: LifeCycle){
if (cycle === LifeCycle.Load){
// it's ready to go
}
}
Note, that the method has lower case "l". The LifeCycle-enum (upper case "L") has these fields:
Init: Start, the constructor is called.Connect: Component connects to backendSetData: A change in the data object occurred.Load: The render process is done and the component has been loadedPreRender: The render method has been called and content is not yet written toinnerHTML.Disconnect: Component is going to be unloaded.Disposed: After calling thedisposemethod.
The life cycle is also available through an event lifecycle. It's exposed via a property called onlifecycle on the element level, too. The events are fired after the internal hook has been called.