there is no JS method for sleep, and most JS engines, when they encounter a loop that tries to mimic sleep, will warn the use of an endless loop (and it might also break the browser). I suggest that you teach you're designers how JS should be used instead. A sleep method, even if implemented correctly, will freeze your browser, which is something you should *never ever* do
On Mon, Apr 4, 2011 at 2:21 PM, Robert <forpoc...@gmail.com> wrote: > I need to delay exit from js method. Normally I am using callbacks, > but I am working with some designers who do not really grasp the > concept. > So I started to think about a way to ease work for them but I am not > sure it is possible at all... > > var test = 0; > var trigger= function(){ test = 1; }; > trigger.delay(5000); > > var main = function(){ > while(test==0){ > sleep(200); > } > return "TEST"; > } > > alert('start'); > if(main()=='TEST'){ > alert('end'); > } > > Is in mootools anything like sleep which would work in similar > context? Maybe some smart trick with delay or periodical? > > > Thanks, > Robert -- Arieh Glazer אריה גלזר 052-5348-561 http://www.arieh.co.il http://www.link-wd.co.il