Created
February 21, 2013 19:10
-
-
Save lukemelia/5007238 to your computer and use it in GitHub Desktop.
chaining jquery then vs jquery always
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 start = Yapp.promise(function(deferred) { | |
console.log("Resolving chain part 1") | |
deferred.resolve() | |
}).always(function(){ | |
return Yapp.promise(function(deferred) { | |
setTimeout(function(){ | |
console.log("Resolving chain part 2") | |
deferred.resolve() | |
}, 100); | |
}) | |
}).always(function(){ | |
return Yapp.promise(function(deferred) { | |
setTimeout(function(){ | |
console.log("Resolving chain part 3") | |
deferred.resolve() | |
}, 25); | |
}) | |
}) | |
// Resolving chain part 1 | |
// Resolving chain part 3 | |
// Resolving chain part 2 |
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 start = Yapp.promise(function(deferred) { | |
console.log("Resolving chain part 1") | |
deferred.resolve() | |
}).then(function(){ | |
return Yapp.promise(function(deferred) { | |
setTimeout(function(){ | |
console.log("Resolving chain part 2") | |
deferred.resolve() | |
}, 100); | |
}) | |
}).then(function(){ | |
return Yapp.promise(function(deferred) { | |
setTimeout(function(){ | |
console.log("Resolving chain part 3") | |
deferred.resolve() | |
}, 25); | |
}) | |
}) | |
// Resolving chain part 1 | |
// Resolving chain part 2 | |
// Resolving chain part 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment