update comments
This commit is contained in:
@@ -25,7 +25,7 @@ public class Emitter {
|
|||||||
* Listens on the event.
|
* Listens on the event.
|
||||||
* @param event event name.
|
* @param event event name.
|
||||||
* @param fn
|
* @param fn
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public Emitter on(String event, Listener fn) {
|
public Emitter on(String event, Listener fn) {
|
||||||
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
||||||
@@ -43,9 +43,9 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Adds a one time listener for the event.
|
* Adds a one time listener for the event.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event an event name.
|
||||||
* @param fn
|
* @param fn
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public Emitter once(final String event, final Listener fn) {
|
public Emitter once(final String event, final Listener fn) {
|
||||||
Listener on = new Listener() {
|
Listener on = new Listener() {
|
||||||
@@ -64,7 +64,7 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Removes all registered listeners.
|
* Removes all registered listeners.
|
||||||
*
|
*
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public Emitter off() {
|
public Emitter off() {
|
||||||
this.callbacks.clear();
|
this.callbacks.clear();
|
||||||
@@ -75,8 +75,8 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Removes all listeners of the specified event.
|
* Removes all listeners of the specified event.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event an event name.
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public Emitter off(String event) {
|
public Emitter off(String event) {
|
||||||
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.remove(event);
|
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.remove(event);
|
||||||
@@ -91,9 +91,9 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Removes the listener.
|
* Removes the listener.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event an event name.
|
||||||
* @param fn
|
* @param fn
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public Emitter off(String event, Listener fn) {
|
public Emitter off(String event, Listener fn) {
|
||||||
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
||||||
@@ -107,9 +107,9 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Executes each of listeners with the given args.
|
* Executes each of listeners with the given args.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event an event name.
|
||||||
* @param args
|
* @param args
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public Emitter emit(String event, Object... args) {
|
public Emitter emit(String event, Object... args) {
|
||||||
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
||||||
@@ -125,8 +125,8 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Returns a list of listeners for the specified event.
|
* Returns a list of listeners for the specified event.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event an event name.
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public List<Listener> listeners(String event) {
|
public List<Listener> listeners(String event) {
|
||||||
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
|
||||||
@@ -137,8 +137,8 @@ public class Emitter {
|
|||||||
/**
|
/**
|
||||||
* Check if this emitter has listeners for the specified event.
|
* Check if this emitter has listeners for the specified event.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event an event name.
|
||||||
* @return a reference to to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public boolean hasListeners(String event) {
|
public boolean hasListeners(String event) {
|
||||||
return !this.listeners(event).isEmpty();
|
return !this.listeners(event).isEmpty();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.concurrent.ThreadFactory;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main thread for event loop.
|
* The thread for event loop. All non-background tasks run within this thread.
|
||||||
*/
|
*/
|
||||||
public class EventThread extends Thread {
|
public class EventThread extends Thread {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user