NYCPHP Meetup

NYPHP.org

[nycphp-talk] the stale V in MVC web apps

David Mintz vtbludgeon at gmail.com
Wed Mar 4 12:01:47 EST 2009


On Wed, Mar 4, 2009 at 11:50 AM, John Campbell <jcampbell1 at gmail.com> wrote:

> I use AJAX polling loops to check if the data is actually stale, and
> then do something about it.



Again, sorry for being dense but I am not sure I understand how this
checking should be performed.

I can imagine possibilities, some of which seem like as much work and
expense as just reloading the data unconditionally.



>
> Writing an ajax polling loop is really quite simple... just make sure
> you use tail recursion, rather than an interval.  I have made that
> mistake in the past, and it hurts.
>
> Dont do:
>
> setInterval(checkStatus,3000);
>
> Do:
>
> // checkStatus must have a callback parameter when complete.
> (function() {
>  var this_function = arguments.callee;
>   checkStatus(function(){
>     setTimeout(this_function,3000);
>   });
> })();
>


Thanks for the tip, but... why is this so?


-- 
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/d6b87ba4/attachment.html>


More information about the talk mailing list