Monday, June 2, 2014

Eventbus question: When to call HandlerRegistration.removeHandler() ?

hi,

I have a question to eventbus handling:
when do I have to  remove handlers from the eventbus via HandlerRegistration.removeHandler() ?
In our application an activity is a presenter as well.
The docs of Activity say:
/**
    * Called when the Activity's widget has been removed from view. All event
    * handlers it registered will have been removed before this method is called.
    */

   
void onStop();

 /**
    * Called when the Activity should ready its widget for the user.
    * ...
    * <p>
    * Any handlers attached to the provided event bus will be de-registered when
    * the activity is stopped, so activities will rarely need to hold on to the
    * {@link com.google.gwt.event.shared.HandlerRegistration HandlerRegistration}
    * instances returned by {@link EventBus#addHandler}.
    * ...
    */

   
void start(AcceptsOneWidget panel, EventBus eventBus);

So, does this mean, I don't have to care about unregistering handlers within my presenter/activity because this is done automatically?
Consecutive starts of an activity/presenter that will register handlers in their start-method will NOT cause duplicate registrations of the same handler ?

I browsed the GWT sources (2.5.1) but didn't find a concluding answer to this.

TIA
Kibu

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment