public interface EventEmitter
EventEmitterImpl
Modifier and Type | Method and Description |
---|---|
void |
disable()
Disables listener registration and event emitting.
|
void |
emit(java.lang.String eventType)
Emits an Event.
|
void |
emit(java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.Object> properties)
Emits an event with a dynamic properties Map.
|
void |
enable()
Enables listener registration and event emitting.
|
void |
off()
De-register all listeners.
|
void |
off(java.lang.String eventType,
int token)
Unregister a listener from listening to an event type.
|
int |
on(java.lang.String eventType,
EventListener listener)
Register an event listener to be called when an EventType is emitted.
|
int |
once(java.lang.String eventType,
EventListener listener)
Similar to on, except that the listener will be removed after
processing one event.
|
void |
request(java.lang.String eventType,
EventListener listener)
Requests a response from the first listener to respond.
|
void |
request(java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.Object> properties,
EventListener listener)
Request a response from the first listener to respond.
|
void |
respond(Event event)
Respond to a request.
|
void |
respond(java.util.Map<java.lang.String,java.lang.Object> properties)
Respond to a request.
|
int on(java.lang.String eventType, EventListener listener)
eventType
- listener
- EventListener
int once(java.lang.String eventType, EventListener listener)
eventType
- listener
- EventListener
void off()
void off(java.lang.String eventType, int token)
eventType
- token
- void emit(java.lang.String eventType)
eventType
- void emit(java.lang.String eventType, java.util.Map<java.lang.String,java.lang.Object> properties)
eventType
- properties
- void request(java.lang.String eventType, EventListener listener)
eventType
- The type of Event to emit and expect a response from.listener
- A listener to process the response. After processing, the response should be removed.EventListener
void request(java.lang.String eventType, java.util.Map<java.lang.String,java.lang.Object> properties, EventListener listener)
eventType
- The type of Event to emit and expect a response from.properties
- A Map of properties to pass along the event chainlistener
- A listener to process the response. After processing, the response should be removedEventListener
void respond(java.util.Map<java.lang.String,java.lang.Object> properties)
properties
- void respond(Event event)
event
- An Event object with, at minimum, the necessary REQUEST_TOKEN valuevoid enable()
void disable()