Friday, June 25, 2010

Re: Code after History.fireCurrentHistoryState() will execute any more?

Do it the second way. I'm not sure if the new history token will kick
in before the javascript has finished (i.e. Do_my_work() might still
be executed even if the user is not logged in).

On Jun 22, 5:19 pm, mahesh <connect.mah...@gmail.com> wrote:
> hi,
>
> I have an MVP app, on which i'm showing different views on the same
> container as per the history token. So one of my view has a context
> checking logic, that checks whether the logged in cookie is there or
> not. If no cookie, I need to redirect to the login view by changing
> the history token. So I wrote a method EnsureUserLoggedin() which will
> check the cookie; if cookie not found, the method will add new history
> token "login" and my global history change handler will do the rest.
>
> I'm consuming that method like the following.....
>
> {
>    EnsureUserLoggedin();
>
>       Do_my_work();
>       ---------------;
>       ---------------;
>
> }
>
> I fear whether this can cause any memory leak? Will this?
>
> If so should i write like the following
>
> {
>    if(UserLoggedin()) {
>
>       Do_my_work();
>       ---------------;
>       ---------------;
>    }
>    else{
>       History.newItem("login");
>    }
>
> }
>
> or you have any other suggestions on it?

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