Triggering events with Handles
You can trigger Events on components using a Handle. A Handle is a unique identifier that can be shared can with other components by passing it as a @Prop. Use new Handle() to create a new Handle and assign it to a component using the .handle(..) method in the component's builder.
In the following LayoutSpec we apply a Handle (passed in as a @Prop) to a TextInput component.
Components with a reference to the TextInput's handle can now manipulate it directly.
Trigger custom events
You can trigger your own custom events.
Declare your event class.
Create a trigger for your event inside your spec using the @OnTrigger annotation. This method will have access to event's parameters using @FromTrigger, as well as the components Props and State.
Usages of your component must be assigned a Handle. The event can be triggered anywhere we have a reference to the Handle.