public class EventEmitterImpl extends java.lang.Object implements EventEmitter
| Modifier and Type | Field and Description |
|---|---|
protected android.os.Handler |
handler |
| Constructor and Description |
|---|
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, passing along the properties map
|
void |
enable()
Enables listener registration and event emitting.
|
protected com.brightcove.player.event.InvocationContainer |
getInvocationContainerByToken(java.util.List<com.brightcove.player.event.InvocationContainer> invocations,
int token)
Returns the InvocationContainer in a list of Containers which matches the token
|
protected int |
getInvocationContainerPositionByToken(java.util.List<com.brightcove.player.event.InvocationContainer> invocations,
int token)
Returns the position of an invocationContainer
|
void |
off()
Removes all listeners.
|
void |
off(java.lang.String eventType,
int token)
Removes a listener from an event queue, using the token as a reference
|
int |
on(java.lang.String eventType,
EventListener listener)
Adds the listener to the event queue, returns a token that the
caller can use to off itself.
|
int |
once(java.lang.String eventType,
EventListener listener)
Similar to on, except that the listener is removed after
processing one event.
|
void |
request(java.lang.String eventType,
EventListener listener)
Attaches a listener and fires off an event of eventType, with the hope that there's a corresponding listener set
to 'respond' to the listener specified in the request.
|
void |
request(java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.Object> properties,
EventListener listener)
Similar to above, except the properties map is passed along
|
void |
respond(Event event)
Convenience method to save the user from typing event.properties when responding
|
void |
respond(java.util.Map<java.lang.String,java.lang.Object> properties)
Meant to respond to a request event.
|
public int on(java.lang.String eventType,
EventListener listener)
on in interface EventEmittereventType - A String representing the Event to be listened forlistener - An abstract class of EventListener, that contains a method to process during an Event's firingEventListener,
EventEmitter.on(String, com.brightcove.player.event.EventListener)public int once(java.lang.String eventType,
EventListener listener)
once in interface EventEmittereventType - Same as for 'on'; a string representing the event to be listened forlistener - Subclass of EventListenerEventListener,
EventEmitter.once(String, com.brightcove.player.event.EventListener)public void off()
off in interface EventEmitterpublic void off(java.lang.String eventType,
int token)
off in interface EventEmittereventType - A string representing the Event typetoken - Integer-valued token that was created during 'on'EventEmitter.off(String, int)public void emit(java.lang.String eventType)
emit in interface EventEmittereventType - EventEmitter.emit(String)public void emit(java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.Object> properties)
emit in interface EventEmittereventType - properties - EventEmitter.emit(String, java.util.Map)public void request(java.lang.String eventType,
EventListener listener)
request in interface EventEmittereventType - The type of Event to emit and expect a response fromlistener - A listener to process the response. After processing, the response should be removedEventEmitter.request(String, com.brightcove.player.event.EventListener),
EventListenerpublic void request(java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.Object> properties,
EventListener listener)
request in interface EventEmittereventType - The type of Event to emit and expect a response fromproperties - A Map of properties to pass along the event chainlistener - A listener to process the response. After processing, the response should be removedEventEmitter.request(String, java.util.Map, com.brightcove.player.event.EventListener),
EventListenerpublic void respond(java.util.Map<java.lang.String,java.lang.Object> properties)
respond in interface EventEmitterproperties - public void respond(Event event)
respond in interface EventEmitterevent - An Event containing properties to pass on to the Request listenerEventprotected int getInvocationContainerPositionByToken(java.util.List<com.brightcove.player.event.InvocationContainer> invocations,
int token)
token - InvocationContainerprotected com.brightcove.player.event.InvocationContainer getInvocationContainerByToken(java.util.List<com.brightcove.player.event.InvocationContainer> invocations,
int token)
invocations - token - InvocationContainerpublic void enable()
enable in interface EventEmitterpublic void disable()
disable in interface EventEmitter