Major bug: call does not remove
funcArr[name]after iterating them so if you add something to the "first" queue and call the first queue, adding something to the first queue will still have the functions from before you called the queue earlier. I created a (demo of the issue); as you see the alert will be shown twice asfuncArr[name]is never emptiedYou're storing keys (function names) in the array
funcArr.funcArrshould be a hash object rather than an array.You're using
for..inon an array (why this is badwhy this is bad) and moreover, the variablefuncwill be global. Use a regular for loop instead here. I'd recommend using$.eachhere. With$.eachyou'd write the loop$.each(funcArr, function(i, fn) { var dfd = $.Deferred(); fn(dfd); promiseArr.push(dfd.promise()); });You're module pattern seems off... 1) its common convention that a class name should be capitalized, ie
MyQueue, 2) theres no real reason to use thethiskeyword if you're not planning to add these functions on prototype, 3) Inthis.startyour linethis.call(ord.pop());is a bit confusing.
As you were not making use of prototype in your function I adapted your code to use the "module pattern". This allows your module to be created without thenewkeyword whereas before it would of caused major issues.