return "null";
}
protected <H extends FBEventHandler> HandlerRegistration addFBEventHandler(final H handler, final GwtEvent.Type<H> eventType, final FBEventType fbEventType) {
if (callbackFunctionsByEvent.get(fbEventType) == null) {
JSFunction callbackFunction = subscribeToEvent(fbEventType);
callbackFunctionsByEvent.put(fbEventType, callbackFunction);
}
final HandlerRegistration handlerRegistration = eventBus.addHandler(eventType, handler);
return new HandlerRegistration() {
@Override
public void removeHandler() {
handlerRegistration.removeHandler();
// defer in case the handler removal has been deferred
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
JSFunction callbackFunction = callbackFunctionsByEvent.get(fbEventType);
if (callbackFunction != null && eventBus.getCount(eventType) == 0) {
unsubscribeFromEvent(fbEventType, callbackFunction);
callbackFunctionsByEvent.remove(fbEventType);
}
}