Created
August 14, 2015 19:18
-
-
Save CodeVachon/656c849cf9a2d54c8b0b to your computer and use it in GitHub Desktop.
Sifting Through Promise Docs Ex
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
function myCallingMethod() { | |
var _deferred = new $.Deferred() | |
var _myValue = 123; | |
setTimeout(function() { | |
_deferred.resolve(_myValue); | |
}, 500); | |
return _deferred.promise(); | |
} | |
var myPromise = myCallingMethod(); | |
myPromise.done(function(myValue) { | |
alert(myValue); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment