Created
September 20, 2012 23:59
-
-
Save rocktronica/3759035 to your computer and use it in GitHub Desktop.
window.wait
This file contains hidden or 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 wait = new function Wait() { | |
var list = this.list = {}; | |
this.callback = function() { }; | |
this.add = function(s) { | |
list[s] = true; | |
}; | |
this.remove = function(s) { | |
list[s] = false; | |
if (this.ready()) { | |
this.callback(); | |
} | |
}; | |
this.ready = function() { | |
for (key in list) { | |
if (list[key]) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment