mirror of
https://github.com/zaaarf/geb.git
synced 2024-11-22 15:34:48 +01:00
feat: unregisterListener
This commit is contained in:
parent
fd87c90d63
commit
b68b0cb0f6
2 changed files with 18 additions and 0 deletions
|
@ -43,6 +43,15 @@ public class GEB implements IBus {
|
||||||
this.listenerMap.put(listener.getClass(), listener);
|
this.listenerMap.put(listener.getClass(), listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister a listener from the bus.
|
||||||
|
* @param listener the listener
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void unregisterListener(IListener listener) {
|
||||||
|
this.listenerMap.remove(listener.getClass());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches an event, calling all of its listeners that are subscribed to this bus.
|
* Dispatches an event, calling all of its listeners that are subscribed to this bus.
|
||||||
* @param event the event to fire
|
* @param event the event to fire
|
||||||
|
|
|
@ -12,6 +12,15 @@ public interface IBus {
|
||||||
*/
|
*/
|
||||||
void registerListener(IListener listener);
|
void registerListener(IListener listener);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister a listener from the bus.
|
||||||
|
* While sensible implementations can get this quite fast, it's generally
|
||||||
|
* faster to use {@link IListener#isActive()}, so only use this if you
|
||||||
|
* *mean* to unregister for good.
|
||||||
|
* @param listener the listener
|
||||||
|
*/
|
||||||
|
void unregisterListener(IListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches an event, calling all of its listeners that are subscribed to this bus.
|
* Dispatches an event, calling all of its listeners that are subscribed to this bus.
|
||||||
* @param event the event to fire
|
* @param event the event to fire
|
||||||
|
|
Loading…
Reference in a new issue