Created
November 25, 2017 02:14
-
-
Save rohanrhu/a679be4c85fd44a23b0388369cccadfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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