OnAttached
annotation class OnAttached
A method annotated with this annotation is called when the component is attached to the ComponentTree.
In a component spec, you can acquire resources in @OnAttached method, and release them in @OnDetached method.
For example: @OnAttached
void onAttached(
ComponentContext c,
@Prop final DataSource dataSource,
@State final SourceListener sourceListener) {
dataSource.subscribe(sourceListener);
}