Skip to content

Instantly share code, notes, and snippets.

@rocktronica
Created September 20, 2012 23:59
Show Gist options
  • Save rocktronica/3759035 to your computer and use it in GitHub Desktop.
Save rocktronica/3759035 to your computer and use it in GitHub Desktop.
window.wait
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