Package com.tenio.core.event.implement
Class EventHandler<T>
java.lang.Object
com.tenio.core.event.implement.EventHandler<T>
- Type Parameters:
T
- the template
This class for handling events and these subscribers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all events and these handlers.final Object
emit
(ServerEvent event, T... params) Emit an event with its parameters.void
subscribe
(ServerEvent event, Emitter<T> emitter) Create a link between an event and its list of event handlers.
-
Constructor Details
-
EventHandler
public EventHandler()Constructor.
-
-
Method Details
-
subscribe
Create a link between an event and its list of event handlers.- Parameters:
event
- seeServerEvent
emitter
- seeEmitter
-
emit
Emit an event with its parameters.- Parameters:
event
- seeServerEvent
params
- a list parameters of this event- Returns:
- the event result (the response of its subscribers), see
Object
or null
-
clear
public void clear()Clear all events and these handlers.
-