Skip to content

Instantly share code, notes, and snippets.

@rohanrhu
Created November 25, 2017 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohanrhu/a679be4c85fd44a23b0388369cccadfe to your computer and use it in GitHub Desktop.
Save rohanrhu/a679be4c85fd44a23b0388369cccadfe to your computer and use it in GitHub Desktop.
var SuccessQueuee = function () {
this.queuee = [];
this.is_ran = false;
};
SuccessQueuee.prototype.push = function (func) {
if (this.is_ran) {
func();
return false;
}
this.queuee.push(func);
};
SuccessQueuee.prototype.pop = function () {
return this.queuee.pop();
};
SuccessQueuee.prototype.run = function () {
if (this.is_ran) {
return false;
}
this.queuee.forEach(function (_func, _func_i) {
_func();
});
this.is_ran = true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment