Skip to content

Instantly share code, notes, and snippets.

@rubeniskov
Created May 19, 2015 16:19
Show Gist options
  • Save rubeniskov/ffb7e41542c23057cd21 to your computer and use it in GitHub Desktop.
Save rubeniskov/ffb7e41542c23057cd21 to your computer and use it in GitHub Desktop.
var Queue = function(){
return (function(q,p,n,d,e){
return {
enqueue : e=function(fn){
q.splice(++p, 0,fn||n);
},
dequeue : d=function(){
return (q.shift()||n).call(null, function(){d()},p=-1)
}
}
})([], -1, function(){});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment