-
Website
http://paulmwatson.com/journal -
Original page
http://paulmwatson.com/journal/2006/05/19/javascript-function-queue/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
aidanf
1 comment · 3 points
-
keithbohanna
1 comment · 1 points
-
martinmurphy
1 comment · 1 points
-
jufemaiz
1 comment · 1 points
-
lxsg
1 comment · 1 points
-
-
Popular Threads
function fQueue()
{
var pos = 0;
var queue = arguments;
return function()
{
if ( pos < queue.length )
queue[pos++]();
}
}
function DoThingOne(whenDone)
{
document.getElementById("Output").innerHTML += "Thing One!<br>";
whenDone();
}
function DoThingTwo(whenDone)
{
document.getElementById("Output").innerHTML += "Thing Two!<br>";
whenDone();
}
function DoThingThree(whenDone)
{
document.getElementById("Output").innerHTML += "Thing Three!<br>";
whenDone();
}
function DoThings()
{
var q = fQueue(
function(){DoThingOne(q);},
function(){DoThingTwo(q);},
function(){DoThingThree(q);});
q();
}
...no idea if that's close to what you're looking for, but if it is and you get rich, send me a pizza.
A *solid gold* pizza.
With pepperoni and mushrooms.
*Morel* mushrooms.
-josh
see: http://www.railsdevelopment.com/2006/01/15/effe...
Then use the afterFinish option for executing arbitrary code when the effect is done.
http://www.safalra.com/programming/javascript/q...
var queue = new Array()
//Enqueue
queue.push(obj);
//Dequeue
obj = queue.shift()