Created
June 6, 2016 18:47
-
-
Save vamshi4001/67ea68e0a3038b294a5920f36a900ec3 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
var myFunc = function () { | |
myOtherFunc(); | |
console.log('hi'); | |
}; | |
var myFunc2 = function(){ | |
var deferred = jQuery.Deferred(); | |
var x = myOtherFunc2(deferred); | |
x.then(function(data){ | |
console.log(data); | |
}); | |
}; | |
var myOtherFunc = function(){ | |
setTimeout(function(){console.log('123');}, 5000); | |
}; | |
var myOtherFunc2 = function(deferred){ | |
var data = "12345"; | |
return deferred.resolve(data); | |
}; | |
myFunc(); | |
myFunc2(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment