luciddream
Programmer
if anyone has every been upset that javascript doesn't have a sleep function, i just wrote one. it doesn't wait the exact amount of time.... but, it's really close.
so:
function sleep(num)
{
var f = new Date();
f = new Number(f);
f = f + num;
while(true)
{
var n = new Date()
n = new Number;
if(n >= f)
{
break;
}
}
}
then you just call it like:
sleep(5000);
where 5000 is the number of milliseconds you want it to sleep for. adam@aauser.com
so:
function sleep(num)
{
var f = new Date();
f = new Number(f);
f = f + num;
while(true)
{
var n = new Date()
n = new Number;
if(n >= f)
{
break;
}
}
}
then you just call it like:
sleep(5000);
where 5000 is the number of milliseconds you want it to sleep for. adam@aauser.com