Skip to content

Instantly share code, notes, and snippets.

@vamshi4001
Created June 6, 2016 18:47
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 vamshi4001/67ea68e0a3038b294a5920f36a900ec3 to your computer and use it in GitHub Desktop.
Save vamshi4001/67ea68e0a3038b294a5920f36a900ec3 to your computer and use it in GitHub Desktop.
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