Skip to content

Instantly share code, notes, and snippets.

@yanqiw
Created September 9, 2016 05:49
Show Gist options
  • Save yanqiw/378ab714872fc2de1e52833769360978 to your computer and use it in GitHub Desktop.
Save yanqiw/378ab714872fc2de1e52833769360978 to your computer and use it in GitHub Desktop.
javascript async
function asyncEvent(){
    var dfd = jQuery.Deferred();
    setTimeout(function () {
      dfd.resolve();
    }, 500);
    return dfd.promise();
  }
function resovleCallback(){
console.log('resolved');
}
jQuery.when(asyncEvent()).then(resovleCallback)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment