Initial commit
This commit is contained in:
23
src/main/java/com/github/nkzawa/socketio/client/On.java
Normal file
23
src/main/java/com/github/nkzawa/socketio/client/On.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.github.nkzawa.socketio.client;
|
||||
|
||||
import com.github.nkzawa.emitter.Emitter;
|
||||
|
||||
public class On extends Emitter {
|
||||
|
||||
private On() {}
|
||||
|
||||
public static Handle on(final Emitter obj, final String ev, final Listener fn) {
|
||||
obj.on(ev, fn);
|
||||
return new Handle() {
|
||||
@Override
|
||||
public void destroy() {
|
||||
obj.off(ev, fn);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static interface Handle {
|
||||
|
||||
public void destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user