Monday, September 6, 2010

Re: MVP Question

A couple of observations:

o Consider presenters as singletons
o Consider Gin

I'm sure others will provide additional observations.


On 09/06/2010 01:10 PM, Jambi wrote:
> Hey guys,
>
> I have some problems with my MVP architecture. Do I have to "destroy"
> my old presenter instances when I´m creating a new one? For example:
>
> I´m on page A and switch to page B. After that I go back to page A and
> create another instance of pageApresenter with my history management.

I don't use history management (yet), but you shouldn't need to create a
new presenter just to go to a place.

> But it feels, that the old instance of my presenter runs in the
> background and is also affecting my actions. When I´m now fireing an
> event to the eventBus the event is called twice or more often if I
> switch another time to page B and then back to page A.

That's what we call a "clue" :)

You probably want to deregister your handlers before switching to Page
B, and reregister upon returning to page A.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment