Skip to content

Instantly share code, notes, and snippets.

@CodeVachon
Created August 14, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeVachon/656c849cf9a2d54c8b0b to your computer and use it in GitHub Desktop.
Save CodeVachon/656c849cf9a2d54c8b0b to your computer and use it in GitHub Desktop.
Sifting Through Promise Docs Ex
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