Skip to content

Instantly share code, notes, and snippets.

@CodeVachon

CodeVachon/app.js

Created Aug 14, 2015
Embed
What would you like to do?
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