O'Reilly logo

jQuery in Action, Third Edition by Yehuda Katz Bear Bibeault and Aurelio De Rosa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Avoiding the callback hell with Deferred

This chapter covers

  • What promises are and why they’re important
  • The Deferred object
  • How to manage multiple asynchronous operations
  • Resolving and rejecting a promise

For a long time, JavaScript developers have used callback functions to perform several tasks such as running operations after a given amount of time (using set-Timeout()), or at regular intervals (using setInterval()), or to react to a given event (click, keypress, load, and so on). We’ve discussed and employed callbacks extensively to perform asynchronous operations; for example, in chapter 6 where we focused on events, in chapter 8 when we talked about animations, and in chapter 10 where we covered Ajax. Callback functions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required