Subj : Re: Looking for Spidermonkey equivalent of Mozilla/DOM trick... To : Igor Bukanov From : Anton van Straaten Date : Sat Nov 29 2003 07:13 am Igor Bukanov wrote: > Anton van Straaten wrote: > >> Igor Bukanov wrote: >> >>> Anton van Straaten wrote: >>> >>>> Since this program is already structured around setTimeout, I'm >>>> wondering if there are any easy tricks similar to setTimeout that I >>>> can use under Spidermonkey without DOM? I could implement a >>>> trampoline-style top-level loop and do this myself, I'm just looking >>>> for a lazy way out. >>> >>> >>> >>> >>> What about pure EcmaScript solution like: >>> >>> var functionToContinue = callTheProgram(); >>> while (functionToContinue != null) { >>> functionToContinue(); >>> } >>> >>> where you program instead of calling setTimeout and returning would >>> simply return function to continue that would be called from the top >>> level? >> >> >> >> Thanks, that's more or less what I meant by a "trampoline-style >> top-level loop". It would work, but the problem in this case is that >> the program in question is not currently set up to do this, and would >> require some restructuring. So I was hoping for a shortcut... > > > But why does it need any restructuring? In the following example the > only restructuring that is necessary compared with version in the >