Last active
August 29, 2015 13:56
-
-
Save medikoo/9017124 to your computer and use it in GitHub Desktop.
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
// 1. Deferred | |
var asyncFn1 = function () { | |
var deferred = new Deferred(); | |
// Initialize async operation and resolve it with either: | |
// deferred.resolve or deferred.reject | |
return deferred.promise; | |
}; | |
// 2. Promise | |
var asyncFn2 = function () { | |
return new Promise(function (resolve, reject) { | |
// Initialize async operation and resolve it with either: | |
// resolve or reject | |
}); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment