Sunday, June 22, 2014

Re: Ignoring requestFactory responses on page reload

Thomas,

Thank you for the detailed answer (as always) :)

Cheers
Samin

On Thursday, June 19, 2014 9:01:21 PM UTC+10, Thomas Broyer wrote:
If you go to http://jsfiddle.net/vX8uK/ you'll see that you'll have an onbeforeunload event (in GWT, Window.ClosingEvent) before the request is abort with status=0, and then you have the onunload (in GWT, CloseEvent).
That means you can listen to Window.ClosingEvent and set a flag to ignore subsequent errors. In case you have a prompt in Window.ClosingEvent added by other means (e.g. Places & Activities), then you'll have to handle the case where the user canceled the navigation and unset your flag; you can do that, for example, by resetting the flag in case of successful response, and/or listen to some mouse or keyboard events.
To centralize the flag processing, use a custom RequestTransport extending the DefaultRequestTransport and wrapping the RequestCallback to deal with the responses (at the RequestBuilder level, before they're transformed to RequestFactory's Receiver calls)

On Thursday, June 19, 2014 8:40:14 AM UTC+2, Samin Pour wrote:
Hi Alberto,

Thanks for your tip :) Unfortunately I can't inform the user to wait (I mean the product description is to let the user to do what ever they want without disturbing them) So I need to find the way to let the Receiver class not to wait for the response.

Any ideas?

Thanks again
Samin

On Tuesday, June 17, 2014 5:04:50 PM UTC+10, Alberto Mancini wrote:
Hi Samir,
the page refresh should call the closinghandler cause a refresh is a page unload followed by a load and the closing handler essentially
is a listener to 'onbeforeunload' event.

Cheers,
   Alberto

Note:
there are issues with the returned message so if you go for a closing handler read this also:






On Tue, Jun 17, 2014 at 7:10 AM, Samin Pour <sam...@gmail.com> wrote:
Thanks Alberto :)

Isn't this handler triggered for closing the Window? I'm just refreshing a page which doesn't fire the associated event. Or am I missing something?

Thanks again
Samin


On Friday, June 13, 2014 10:31:25 PM UTC+10, Alberto Mancini wrote:
to inform the user that should wait until the response is ready.
I think it is at least less dangerous than ignoring eventual errors.

Alberto.





--
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-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

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