mirror of
https://github.com/zaaarf/geb.git
synced 2024-11-24 19:14:50 +01:00
feat: isRegistered method on IBus
This commit is contained in:
parent
216159feec
commit
3dc755f0c7
2 changed files with 14 additions and 1 deletions
|
@ -63,6 +63,12 @@ public class GEB implements IBus {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegistered(IListener listener) {
|
||||
Set<IListener> listeners = this.listenerMap.get(listener.getClass());
|
||||
return listeners != null && listeners.contains(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an event, calling all of its listeners that are subscribed to this bus.
|
||||
* @param event the event to fire
|
||||
|
|
|
@ -13,11 +13,18 @@ public interface IBus {
|
|||
void registerListener(IListener listener);
|
||||
|
||||
/**
|
||||
* Unregister a listener from the bus.
|
||||
* Unregisters a listener from the bus.
|
||||
* @param listener the listener
|
||||
*/
|
||||
void unregisterListener(IListener listener);
|
||||
|
||||
/**
|
||||
* Tells you whether a listener is currently registered.
|
||||
* Ideally this should be efficient.
|
||||
* @return true if the listener is registered
|
||||
*/
|
||||
boolean isRegistered(IListener listener);
|
||||
|
||||
/**
|
||||
* Dispatches an event, calling all of its listeners that are subscribed to this bus.
|
||||
* @param event the event to fire
|
||||
|
|
Loading…
Reference in a new issue