You can use setTimeout (or setInterval). That will require you to make
the target loop into a function, though.


joe ertaba wrote:
> Hi
>
> I need to add sleep function in some procedure, I found some sleep
> function
>
> function sleep(mTime)
> {
>   var sleeping = true;
>   var now = new Date();
>   var alarm;
>   var startingMSeconds = now.getTime();
>   while(sleeping){
>      alarm = new Date();
>      alarmMSeconds = alarm.getTime();
>      if(alarmMSeconds - startingMSeconds > mTime)
>         sleeping = false;
>   }
> }
>
> but it causes program to hang, any better sleep function ?
> P.S: I cant use setTimeout function either
> ------------------------------------------------------------------------
>
> _______________________________________________
> Project_owners mailing list
> [email protected]
> https://www.mozdev.org/mailman/listinfo/project_owners
>   

_______________________________________________
Project_owners mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/project_owners

Reply via email to