[nycphp-talk] the stale V in MVC web apps
David Mintz
vtbludgeon at gmail.com
Wed Mar 4 12:48:57 EST 2009
On Wed, Mar 4, 2009 at 12:26 PM, John Campbell <jcampbell1 at gmail.com> wrote:
> On Wed, Mar 4, 2009 at 12:10 PM, David Mintz <vtbludgeon at gmail.com> wrote:
> >
> > On Wed, Mar 4, 2009 at 12:01 PM, David Mintz <vtbludgeon at gmail.com>
> wrote:
> >>>
> >> Thanks for the tip, but... why is this so?
> >>
> >
> > Cancel that, I think
> >
> http://blog.paulbonser.com/2007/11/18/extending-javascript-tail-recursion/
> > is trying to help me out on this one.
>
> The problem is with intervals, is that if someone's connection flakes
> out for a minute or two, you end up doing tons of ajax calls that all
> overlap causing wacky behavior. The point of tail recursion is to
> wait for the ajax call to complete, before starting the timer to do a
> new request.
Aaah, thank you. Very clearly stated.
I have a page where I *think* I am doing that albeit in a roundabout way.
When the document loads initially I set the timer. When the xhr completes,
my xhr callback resets the timer. The interval is five minutes. The
following is with Prototype.
// on load
window.updater = window.setInterval(submitForm,updateInterval);
// and...
submitForm = function(){
$('searchForm').request({
onCreate:function(response){$('formSubmit').value="Processing..."},
onComplete:function(xhr){
// reset timer
window.clearInterval(updater);
window.updater = window.setInterval(submitForm,updateInterval);
$('formSubmit').value="Search" // reset button's value
// etc
}
});
};
--
David Mintz
http://davidmintz.org/
The subtle source is clear and bright
The tributary streams flow through the darkness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090304/c775e77c/attachment.html>
More information about the talk
mailing list