Created
August 17, 2011 02:40
-
-
Save kdonald/1150698 to your computer and use it in GitHub Desktop.
$.Deferred refactoring
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
// BEFORE $.Deferred() | |
mainView.render(function(root) { | |
var mainContent = root.find("#content"); | |
subView.render(function(el) { | |
mainContent.append(el); | |
nestedView.render(function(el) { | |
mainContent.append(el); | |
allDoneCallback(root); | |
}); | |
}); | |
}); | |
// AFTER $.Deferred() | |
mainView.render().append(subView, "#content").append(nestedView, "#content").done(allDoneCallback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment