Was ist der Eventbus in die AbstractActivity.start in GWT, für das Sie verwendet werden sollen?

StackOverflow https://stackoverflow.com/questions/9524004

Frage

Bevor ich das Tätigkeitsrahmen benutze, würde ich normalerweise eine Global / Singleton-Instanz des GWT-Eventbus haben.Jetzt bemerkte ich, dass die Aktivitätsklasse eine Instanz in meine Aktivitäten passiert.Ist dieses Eventbus dazu gedacht, die clientseitige generische Botschaft von clientseitig vorzunehmen oder etwas anderes?

War es hilfreich?

Lösung

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).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top