Question

Before using the activities framework I would typically have one Global/Singleton instance of the GWT EventBus. Now I noticed the activity class passes an instance into my activities. Is this eventbus intended to do cross-application client-side generic message passing or something else?

Was it helpful?

Solution

It is a reference to the same EventBus that you instantiated the ActivityManager with, and is intended to be used as a global event bus for the whole application. Use it for things that transcend an Activity.

Before it is passed into your activity, it gets wrapped so that any handlers you add to it only get called while the activity is still active (which simplifies clean up).

From the start() JavaDoc:

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 HandlerRegistration instances returned by EventBus.addHandler(com.google.web.bindery.event.shared.Event.Type, H).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top