Every Fluid component has a standard lifecycle, various points of which are signalled by firing of standard framework events. Every component which has a grade of fluid.component has these events attached, and the framework will fire them as the component reaches the appropriate lifecycle points. The events, in the expected order of firing for a component, are as follows:
||Fired when component construction is complete - that is, all options have been merged for the component and all subcomponents (which were not marked with createOnEvent) have constructed.|
||Fired when the component is about to be destroyed. This will be a preliminary to beginning the destruction process for all its subcomponents.|
Fired after the component and its children have been completely destroyed, and detached from any parent component.
Note: At this point you may only safely access plain data members of the component such as id and typeName. Do not attempt to invoke any methods, fire any events, or resolve any IoC references from listeners to this event.
although it will as noted above be detached from its parent (via a call to
delete) and similarly all subcomponent references will be recursively detached from their parents.
The component author may schedule various actions to clean up any external resources (perhaps a jQuery widget, or a network connection) during the destruction process by adding listeners to the
Every Fluid component is supplied with a standard method named
destroy which is available after
onCreate has fired.
destroy takes no arguments and will initiate the destruction process for the component -
onDestroy followed by
fluid.isDestroyed(component)- this will return
trueif the object reference represents a component which has been destroyed.