How would you cause the delay? I didn't think there was a sleep()-style function in JS.
----- Original Message ---- From: Aaron Boodman <[EMAIL PROTECTED]> To: Mozdev Project Owners List <[email protected]> Sent: Sunday, July 23, 2006 7:56:19 PM Subject: Re: [Project_owners] JS help For the naysayers, there's some really fun stuff you can do with syntax like this. For example, you can simulate threading by breaking up long operations into small chunks, without devolving into OO state machine madness. function doLongThing() { var i = 0; queue(function() { if (i > max) { alert("done"); return; } // do work here using i queue(arguments.callee); }); } The queue() function can decide whether to call the function immediately or delay it using whatever logic it wants. I need to write an article about this. - a On 7/23/06, Karsten Düsterloh <[EMAIL PROTECTED]> wrote: > Konstantin Svist aber hob zu reden an und schrieb: > > You will be unable to use foo() even from within the function that > > defined foo > > source: > > http://academ.hvcc.edu/~kantopet/old/javascript/index.php?page=adv+js+functions&parent=js+functions > > > > another way (i think this might be deprecated) > > "You can make recursive calls within an anonymous function using > > arguments.callee , which is a reference to the currently executing > > function (even if it has no name)." > > source: http://www.dustindiaz.com/awkward-looking-javascript/ > > It might be worth looking at m.o directly: > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Functions#Function_constructor_vs._function_declaration_vs._function_expression > > > Karsten > > > Karsten > -- > Feel free to correct my English. :) > _______________________________________________ > Project_owners mailing list > [email protected] > http://mozdev.org/mailman/listinfo/project_owners > _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
