Has anyone discussed adding an "onTimeout" option for Ajax.Request? That would be incredibly useful. Something like this would be great: new Ajax.Request(''/someurl'', { onSuccess: doSomething, timeoutDelay: 10000, onTimeout: doSomethingElse }); timeoutDelay, of course, is milliseconds, as in the window.setTimeout() method. Cheers --Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey Dan, You know, I can''t even count how many times a lingering modal has locked an ajax application that I''ve been using or working on. Every other request worked fine, but for some reason this one is lost in space, who knows where those packets have gone, and at this point who cares. A respectable recovery would be ideal, but in many cases the application is "locked" during these load times, so not only has your request failed, but now your client is compromised. I''ve implemented some things to get around this idea, but for some reason reading your post got me motivated to do some serious monkey patching. Its a pretty cool idea and I''ve got it working really well, only a minimal amount of refactoring was necessary, it wasn''t even half as hard as i expected and wrote the code and did testing this afternoon. For my basic examples it worked fine. Some behind the scenes stuff you may need to know in my example is that the responder.php script is just executing "sleep(delay)" delay being the variable that you send it. Also as with most of my "examples" you gotta read the code and look at your console in firebug to see whats actually going on. The example http://positionabsolute.net/projects/javascript/AjaxTimeout/ My monkey patched version of proto 1.6 http://positionabsolute.net/includes/javascripts/prototype1.6.js -- Matt Foster Ajax Engineer Nth Penguin, LLC http://www.nthpenguin.com On Jun 26, 2:37 pm, Dan Delaney <danfluidm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Has anyone discussed adding an "onTimeout" option for Ajax.Request? > That would be incredibly useful. Something like this would be great: > > new Ajax.Request(''/someurl'', { onSuccess: doSomething, timeoutDelay: > 10000, onTimeout: doSomethingElse }); > > timeoutDelay, of course, is milliseconds, as in the > window.setTimeout() method. > > Cheers > --Dan--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Kind of a strange nuance I just noted was that, when the transport is aborted, the Ajax.Request deems it as a success. Looking into the Ajax.Request.success method, it has right upfront in the condition (! status || ... ) so that makes a status of 0 a success, really? This seems strange now but im sure there is a very good reason. In my refactoring i removed that part of the condition, seemed to test out ok but be forewarned. -- Matt Foster Ajax Engineer Nth Penguin, LLC http://www.nthpenguin.com On Jun 26, 5:35 pm, Matt Foster <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey Dan, > > You know, I can''t even count how many times a lingering modal > has locked an ajax application that I''ve been using or working on. > Every other request worked fine, but for some reason this one is lost > in space, who knows where those packets have gone, and at this point > who cares. A respectable recovery would be ideal, but in many cases > the application is "locked" during these load times, so not only has > your request failed, but now your client is compromised. I''ve > implemented some things to get around this idea, but for some reason > reading your post got me motivated to do some serious monkey > patching. Its a pretty cool idea and I''ve got it working really well, > only a minimal amount of refactoring was necessary, it wasn''t even > half as hard as i expected and wrote the code and did testing this > afternoon. For my basic examples it worked fine. Some behind the > scenes stuff you may need to know in my example is that the > responder.php script is just executing "sleep(delay)" delay being the > variable that you send it. Also as with most of my "examples" you > gotta read the code and look at your console in firebug to see whats > actually going on. > > The examplehttp://positionabsolute.net/projects/javascript/AjaxTimeout/ > > My monkey patched version of proto 1.6http://positionabsolute.net/includes/javascripts/prototype1.6.js > > -- > Matt Foster > Ajax Engineer > Nth Penguin, LLChttp://www.nthpenguin.com > > On Jun 26, 2:37 pm, Dan Delaney <danfluidm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Has anyone discussed adding an "onTimeout" option for Ajax.Request? > > That would be incredibly useful. Something like this would be great: > > > new Ajax.Request(''/someurl'', { onSuccess: doSomething, timeoutDelay: > > 10000, onTimeout: doSomethingElse }); > > > timeoutDelay, of course, is milliseconds, as in the > > window.setTimeout() method. > > > Cheers > > --Dan--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You might want to take a look at: http://dev.rubyonrails.org/ticket/10191 http://dev.rubyonrails.org/ticket/10030 http://dev.rubyonrails.org/ticket/3730 -- kangax On Jun 26, 5:51 pm, Matt Foster <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Kind of a strange nuance I just noted was that, when the transport is > aborted, the Ajax.Request deems it as a success. Looking into the > Ajax.Request.success method, it has right upfront in the condition (! > status || ... ) so that makes a status of 0 a success, really? This > seems strange now but im sure there is a very good reason. In my > refactoring i removed that part of the condition, seemed to test out > ok but be forewarned. > > -- > Matt Foster > Ajax Engineer > Nth Penguin, LLChttp://www.nthpenguin.com > > On Jun 26, 5:35 pm, Matt Foster <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey Dan, > > > You know, I can''t even count how many times a lingering modal > > has locked an ajax application that I''ve been using or working on. > > Every other request worked fine, but for some reason this one is lost > > in space, who knows where those packets have gone, and at this point > > who cares. A respectable recovery would be ideal, but in many cases > > the application is "locked" during these load times, so not only has > > your request failed, but now your client is compromised. I''ve > > implemented some things to get around this idea, but for some reason > > reading your post got me motivated to do some serious monkey > > patching. Its a pretty cool idea and I''ve got it working really well, > > only a minimal amount of refactoring was necessary, it wasn''t even > > half as hard as i expected and wrote the code and did testing this > > afternoon. For my basic examples it worked fine. Some behind the > > scenes stuff you may need to know in my example is that the > > responder.php script is just executing "sleep(delay)" delay being the > > variable that you send it. Also as with most of my "examples" you > > gotta read the code and look at your console in firebug to see whats > > actually going on. > > > The examplehttp://positionabsolute.net/projects/javascript/AjaxTimeout/ > > > My monkey patched version of proto 1.6http://positionabsolute.net/includes/javascripts/prototype1.6.js > > > -- > > Matt Foster > > Ajax Engineer > > Nth Penguin, LLChttp://www.nthpenguin.com > > > On Jun 26, 2:37 pm, Dan Delaney <danfluidm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Has anyone discussed adding an "onTimeout" option for Ajax.Request? > > > That would be incredibly useful. Something like this would be great: > > > > new Ajax.Request(''/someurl'', { onSuccess: doSomething, timeoutDelay: > > > 10000, onTimeout: doSomethingElse }); > > > > timeoutDelay, of course, is milliseconds, as in the > > > window.setTimeout() method. > > > > Cheers > > > --Dan--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 26, 8:06 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You might want to take a look at: > http://dev.rubyonrails.org/ticket/10191 > http://dev.rubyonrails.org/ticket/10030 > http://dev.rubyonrails.org/ticket/3730Thanks Kangax. Those first two don''t have anything to do with a Timeout function, but the last one is a patch that does EXACTLY what I described in the OP! Unfortunately, the patch was submitted two YEARS ago, didn''t work in Safari, and so was never included in prototype. Maybe I''ll download the patch and see if I can get it working in Safari. Or maybe Matt would like to take a look at it. He seems awfully motivated :-) Thanks for that monkey patch, Matt. I can''t express enough how incredibly useful it would be to be able to set a separate timeout period and function for each Ajax.Request. --Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, it would indeed be useful. There are plans for some ajax refactoring in 1.6.1. Most of these annoyances will most likely be fixed. -- kangax On Jun 27, 12:24 pm, Dan Delaney <danfluidm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 26, 8:06 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You might want to take a look at: > >http://dev.rubyonrails.org/ticket/10191 > >http://dev.rubyonrails.org/ticket/10030 > >http://dev.rubyonrails.org/ticket/3730 > > Thanks Kangax. Those first two don''t have anything to do with a > Timeout function, but the last one is a patch that does EXACTLY what I > described in the OP! > > Unfortunately, the patch was submitted two YEARS ago, didn''t work in > Safari, and so was never included in prototype. Maybe I''ll download > the patch and see if I can get it working in Safari. Or maybe Matt > would like to take a look at it. He seems awfully motivated :-) Thanks > for that monkey patch, Matt. > > I can''t express enough how incredibly useful it would be to be able to > set a separate timeout period and function for each Ajax.Request. > > --Dan--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
There''s a ticket here: http://prototype.lighthouseapp.com/projects/8886/tickets/44-timeout-in-ajax-periodicalupdater that added a timeout. It was suggested that it was better left as a plugin. The thing I''d really like to know is why a status of 0 counts as success. If anyone can cast some light on that one I''d be very grateful! Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I have been testing this quite a bit and I''ve come up with my own question now. Is it useful to have a separate event handler for the onTimeout event, or does it make more sense to just abort the request and fire the onFailure event, as in any case, if the request times out, its failed, hasn''t it? -- Matt Foster Ajax Engineer Nth Penguin, LLC http://www.nthpenguin.com On Jun 28, 1:07 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> There''s a ticket here:http://prototype.lighthouseapp.com/projects/8886/tickets/44-timeout-i... > that added a timeout. It was suggested that it was better left as a > plugin. > > The thing I''d really like to know is why a status of 0 counts as > success. If anyone can cast some light on that one I''d be very > grateful! > > Fred--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---