Skip to content

Instantly share code, notes, and snippets.

@dnch
Created June 1, 2010 07:36
Show Gist options
  • Save dnch/420683 to your computer and use it in GitHub Desktop.
Save dnch/420683 to your computer and use it in GitHub Desktop.
var CallbackObject = {
task_a_done = false,
task_b_done = false,
trigger = function(which_task) {
if(which_task == "A") { this.task_a_done = true; }
if(which_task == "B") { this.task_a_done = true; }
if(this.task_a_done && this.task_b_done) {
trigger_task_c();
}
}
}
var ajax_task_a = Ajax.new({ onComplete: function() { CallbackObject.trigger("A"); }};
var ajax_task_b = Ajax.new({ onComplete: function() { CallbackObject.trigger("B"); }};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment