Event - an Enum containing the event names that listeners may be registered forListener - the interface type of the listenerpublic abstract class EventEmitter<Event,Listener>
extends java.lang.Object
Connection object emits events for connection state using the EventEmitter pattern.| Modifier and Type | Class and Description |
|---|---|
protected class |
EventEmitter.Filter |
| Constructor and Description |
|---|
EventEmitter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
apply(Listener listener,
Event event,
java.lang.Object... args) |
void |
emit(Event event,
java.lang.Object... args)
Emits an event, calling registered listeners with the given event name and any other given arguments.
|
void |
off()
Deregisters all registrations, for all events and listeners.
|
void |
off(Event event,
Listener listener)
Removes all registrations that match both the specified listener and the specified event.
|
void |
off(Listener listener)
Deregisters the specified listener.
|
void |
on(Event event,
Listener listener)
Registers the provided listener for the specified event.
|
void |
on(Listener listener)
Registers the provided listener all events.
|
void |
once(Event event,
Listener listener)
Registers the provided listener for the first occurrence of a single named event specified as the Event argument.
|
void |
once(Listener listener)
Registers the provided listener for the first event that is emitted.
|
public void off()
Spec: RTE5
public void on(Listener listener)
Spec: RTE4
listener - The event listener.
This listener is invoked on a background thread.
public void once(Listener listener)
Spec: RTE4
listener - The event listener.
This listener is invoked on a background thread.
public void off(Listener listener)
Spec: RTE5
listener - The event listener.public void on(Event event, Listener listener)
Spec: RTE4
event - The named event to listen for.listener - The event listener.
This listener is invoked on a background thread.
public void once(Event event, Listener listener)
Spec: RTE4
listener - The event listener.event - The named event to listen for.
This listener is invoked on a background thread.
public void off(Event event, Listener listener)
Spec: RTE5
listener - The event listener.event - The named event.public void emit(Event event, java.lang.Object... args)
Spec: RTE5
event - The named event.args - the arguments to pass to listeners