Package com.denormans.facebookgwt.gwtutil.client.js

Examples of com.denormans.facebookgwt.gwtutil.client.js.JSFunction


  }

  private JSFunction subscribeToEvent(final FBEventType eventType) {
    Log.fine("Subscribing to event: " + eventType + " (" + eventType.getApiValue() + ")");

    final JSFunction eventCallbackJSFunction = createEventCallbackFunctionJS(eventType.getApiValue());
    executeWithFB(new Scheduler.ScheduledCommand() {
      @Override
      public void execute() {
        subscribeToEventJS(eventType.getApiValue(), eventCallbackJSFunction);
      }
View Full Code Here


    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);
            }
          }
View Full Code Here

TOP

Related Classes of com.denormans.facebookgwt.gwtutil.client.js.JSFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.