bluescreen303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-08 17:14 UTC
interfering with Ajax.Responders
Hi, Is there a way to get a handle to the ajax-request that gets caught by a responder? At the moment I use this: load: function(url) { if(Ajax.activeRequestCount < 2) { new Ajax.Request( ''/people'', { method:''get'', onSuccess: this.parseAjaxResponse.bind(this) }); } else { this.load.bind(this).defer(url); } }, to make sure there aren''t too many connections open. IE sometimes tripped on those. I would like to put this functionality into a responder so I don''t have to do it everyplace i create requests. It would be nice if the onCreate responder was able to pause the creation, and resume when ready (just like above). Any possible solutions? thanks Mathijs --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you just want to count connections, current versions of Prototype already do that for you, via a built-in Ajax responder. Take a look at "Ajax.activeRequestCount". TAG On Nov 8, 2007, at 10:14 AM, bluescreen303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > Hi, > > Is there a way to get a handle to the ajax-request that gets caught by > a responder? > At the moment I use this: > > load: function(url) { > if(Ajax.activeRequestCount < 2) { > new Ajax.Request( > ''/people'', { > method:''get'', > onSuccess: this.parseAjaxResponse.bind(this) > }); > } else { > this.load.bind(this).defer(url); > } > }, > > to make sure there aren''t too many connections open. IE sometimes > tripped on those. > > I would like to put this functionality into a responder so I don''t > have to do it everyplace i create requests. > It would be nice if the onCreate responder was able to pause the > creation, and resume when ready (just like above). > > Any possible solutions? > > thanks > Mathijs > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bluescreen303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-08 18:26 UTC
Re: interfering with Ajax.Responders
As you can see in my post, I use this method already. I don''t just want to count connections, I want to defer connections until others are finished. I found a way to do this, but for that I need to implement it at every spot where I use Ajax.Request. So I''m looking for a way to overload the default behavior of Ajax.Request or modify it using a responder. tnx anyway On 8 nov, 18:26, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote:> If you just want to count connections, current versions of Prototype > already do that for you, via a built-in Ajax responder. > > Take a look at "Ajax.activeRequestCount". > > TAG > > On Nov 8, 2007, at 10:14 AM, bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > > Hi, > > > Is there a way to get a handle to the ajax-request that gets caught by > > a responder? > > At the moment I use this: > > > load: function(url) { > > if(Ajax.activeRequestCount < 2) { > > new Ajax.Request( > > ''/people'', { > > method:''get'', > > onSuccess: this.parseAjaxResponse.bind(this) > > }); > > } else { > > this.load.bind(this).defer(url); > > } > > }, > > > to make sure there aren''t too many connections open. IE sometimes > > tripped on those. > > > I would like to put this functionality into a responder so I don''t > > have to do it everyplace i create requests. > > It would be nice if the onCreate responder was able to pause the > > creation, and resume when ready (just like above). > > > Any possible solutions? > > > thanks > > Mathijs--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Im not sure if this is what you''re looking for but I have developed a method of queuing requests such that it would only ever allow for one XHR to be in the wind at any given time. http://positionabsolute.net/blog/2007/04/ajax-request-queue.php On Nov 8, 1:26 pm, "bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> As you can see in my post, I use this method already. > I don''t just want to count connections, I want to defer connections > until others are finished. > I found a way to do this, but for that I need to implement it at every > spot where I use Ajax.Request. > So I''m looking for a way to overload the default behavior of > Ajax.Request or modify it using a responder. > > tnx anyway > > On 8 nov, 18:26, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote: > > > If you just want to count connections, current versions of Prototype > > already do that for you, via a built-in Ajax responder. > > > Take a look at "Ajax.activeRequestCount". > > > TAG > > > On Nov 8, 2007, at 10:14 AM, bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > Hi, > > > > Is there a way to get a handle to the ajax-request that gets caught by > > > a responder? > > > At the moment I use this: > > > > load: function(url) { > > > if(Ajax.activeRequestCount < 2) { > > > new Ajax.Request( > > > ''/people'', { > > > method:''get'', > > > onSuccess: this.parseAjaxResponse.bind(this) > > > }); > > > } else { > > > this.load.bind(this).defer(url); > > > } > > > }, > > > > to make sure there aren''t too many connections open. IE sometimes > > > tripped on those. > > > > I would like to put this functionality into a responder so I don''t > > > have to do it everyplace i create requests. > > > It would be nice if the onCreate responder was able to pause the > > > creation, and resume when ready (just like above). > > > > Any possible solutions? > > > > thanks > > > Mathijs--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bluescreen303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-08 19:06 UTC
Re: interfering with Ajax.Responders
It looks very usable indeed. I''ll try it out tomorrow. How should I use this instead of new Ajax.Request() ? On 8 nov, 19:38, Matt Foster <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Im not sure if this is what you''re looking for but I have developed a > method of queuing requests such that it would only ever allow for one > XHR to be in the wind at any given time. > > http://positionabsolute.net/blog/2007/04/ajax-request-queue.php > > On Nov 8, 1:26 pm, "bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > As you can see in my post, I use this method already. > > I don''t just want to count connections, I want to defer connections > > until others are finished. > > I found a way to do this, but for that I need to implement it at every > > spot where I use Ajax.Request. > > So I''m looking for a way to overload the default behavior of > > Ajax.Request or modify it using a responder. > > > tnx anyway > > > On 8 nov, 18:26, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote: > > > > If you just want to count connections, current versions of Prototype > > > already do that for you, via a built-in Ajax responder. > > > > Take a look at "Ajax.activeRequestCount". > > > > TAG > > > > On Nov 8, 2007, at 10:14 AM, bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > > Hi, > > > > > Is there a way to get a handle to the ajax-request that gets caught by > > > > a responder? > > > > At the moment I use this: > > > > > load: function(url) { > > > > if(Ajax.activeRequestCount < 2) { > > > > new Ajax.Request( > > > > ''/people'', { > > > > method:''get'', > > > > onSuccess: this.parseAjaxResponse.bind(this) > > > > }); > > > > } else { > > > > this.load.bind(this).defer(url); > > > > } > > > > }, > > > > > to make sure there aren''t too many connections open. IE sometimes > > > > tripped on those. > > > > > I would like to put this functionality into a responder so I don''t > > > > have to do it everyplace i create requests. > > > > It would be nice if the onCreate responder was able to pause the > > > > creation, and resume when ready (just like above). > > > > > Any possible solutions? > > > > > thanks > > > > Mathijs--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---