• Sunday , 19 November 2017

How to Use Javascript Promises

Code Canyon



This screencast explains the Javascript Promise pattern at a very high level. Promises are a fundamental tool for modern Javascript development, but it’s easy to get overwhelmed when first starting out.

All of the code is pseudo-code meant to make the concept of Promises easier to understand. In a real code base you probably want to use a promise library such as Q or Bluebird instead of using the native Javascript deferred object.

Original source

3d Ocean

Related Posts

44 Comments

  1. Torben Rudgaard
    June 23, 2017 at 04:07

    Great video – thanks for explaining the token thingy at the end.

  2. Gaurav Bakshi
    June 23, 2017 at 04:07

    great stuff, really helpful. keep up the good work.

  3. Eden Reich
    June 23, 2017 at 04:07

    great tutorial ! thanks!

  4. Jalal Maqdisi
    June 23, 2017 at 04:07

    Well done

  5. Chris Cheshire
    June 23, 2017 at 04:07

    Thanks for making this video. Very clear and thorough examples.

  6. etisdew
    June 23, 2017 at 04:07

    Hey, could I talk to you? I am new to JS let alone ES6 but I need to store and get JSON information and use the objects for logic and view. I'm a little over my head. Trying not to bloat up with libs and I think this maybe the solution. Everything will be localStorage or hardcoded.

  7. Steve Bond
    June 23, 2017 at 04:07

    So much info so well presented, well done mate. I can see clearly now … 🙂

  8. Venkatesh M
    June 23, 2017 at 04:07

    Thank you Jordan …

  9. Amin
    June 23, 2017 at 04:07

    before understanding promises and defered, i saw ur tutorial and got confused, but after knowing about it, when i saw it again, you were talking right lol

  10. B Ningomba
    June 23, 2017 at 04:07

    I am just starting to see the video but run into errors in console, why chrome console is throwing error in my case
    var deferred = Promise.defer()
    VM424:1 Uncaught TypeError: Promise.defer is not a function
    at <anonymous>:1:24

  11. KL Tah
    June 23, 2017 at 04:07

    Promise.defer wasn't throw safe so it was removed from Chrome. You can now create a custom deferred object using `new Promise` constructor syntax.

  12. sol0matrix
    June 23, 2017 at 04:07

    great post thanks this explains alot and gave me a clear understanding slides definitely helps 🙂

  13. Ivan Kand
    June 23, 2017 at 04:07

    Like totally, make sense dood 🙂

  14. Scott Butts
    June 23, 2017 at 04:07

    Watched a bunch of videos and still had no idea what Promises were and how they worked. Watched YOUR video and I GOT IT!!!! You did a spectacular job explaining how it worked and how to use it in different situations. Thank you for you video.

  15. sukanta mangal
    June 23, 2017 at 04:07

    Thanks for explaining so well that any js beginner can understand this.

  16. WholeNewLevel2018
    June 23, 2017 at 04:07

    awesome explanation …. most people explain promises in very dry and abstract manner…. what make this tutorial standout is will thought off real world uses of promises and the examples …. this indeed the best video on promises out there ….. thanks so much and please keep up ….

  17. VeslorTV
    June 23, 2017 at 04:07

    YOU ARE A BEAST

  18. Ahmed Eid
    June 23, 2017 at 04:07

    its worth noting that `Promise.defer` is obsolete now , I don't think that it even supported any more …

    great tuturial thou

    thanks

  19. Nicolas Ortiz
    June 23, 2017 at 04:07

    Amazing and wonderful explanation

  20. Roger Price
    June 23, 2017 at 04:07

    Fabulous. Thanks. Super clear…

  21. Amandeep Singh
    June 23, 2017 at 04:07

    sadly, can't use Promise.defer() now in google chrome. 🙁

  22. Amandeep Singh
    June 23, 2017 at 04:07

    You are the "Promise" God!! My search ends on this video.:)

  23. Alexander Bollbach
    June 23, 2017 at 04:07

    "personified as a javascript object" .. wouldn't it be "objectified"

  24. Miguel Stevens
    June 23, 2017 at 04:07

    Great examples! Great video.

  25. ComicBookGuy Henderson
    June 23, 2017 at 04:07

    honestly one of the best online

  26. Jaya Kumar
    June 23, 2017 at 04:07

    Jordan, Excellent explanation, Thank you 🙂

  27. Mike Mackes
    June 23, 2017 at 04:07

    Great job! Really helped me get the concept. Thanks!

  28. Gert-Jan Bark
    June 23, 2017 at 04:07

    Impressive how well you explained the concept of JS promises in such an easy-to-understand way, kudos to you!

  29. Saurav K Singh
    June 23, 2017 at 04:07

    Awesome tutorial on such a complex topic. Huge respect.

  30. Vishnu Prasad
    June 23, 2017 at 04:07

    Awesome, I was so confused with Promises, and this helped me understand it better. Thank you Jordan Leigh

  31. Kerron
    June 23, 2017 at 04:07

    one of the best explanations out there

  32. Luis Faría
    June 23, 2017 at 04:07

    Amazing tutorial. Excellent explanation.

  33. mightyrighty100
    June 23, 2017 at 04:07

    Are you using the normal DevTool console from chrome? when i try the same code like:

    var d1 =Promise.defer()

    it says that "VM390:1 Uncaught TypeError: Promise.defer is not a function
    at <anonymous>:1:17"

    what am i doing wrong?

  34. Nikhil Verma
    June 23, 2017 at 04:07

    Never saw any video explain such concepts so effectively before. Subbed and liked.

  35. caring support group
    June 23, 2017 at 04:07

    what JavaScript framework do you recommend learning right now? I'm in the fence with angular2 and react: I'll prob learn both, but if you had to pick one to start with.. which would you pick? And then, what about the backend..?

  36. Matthew Snow
    June 23, 2017 at 04:07

    Great explanation! It really helped me understand how to use the Q library a lot better.

  37. Bhakti Al Akbar
    June 23, 2017 at 04:07

    Very good explanation! Thanks

  38. Miguel S
    June 23, 2017 at 04:07

    this is it! thanks Jordan that was really helpfull! greetings from Venezuela, keep up the good work!

  39. Bruno Sampaio Pinho da Silva
    June 23, 2017 at 04:07

    Good video!

  40. Youssef Rhindi
    June 23, 2017 at 04:07

    Amazing thanks, keep going

  41. Justin Stuart
    June 23, 2017 at 04:07

    Dude bro… Nicely done.

  42. Julian Wiche
    June 23, 2017 at 04:07

    wow. Amazing! You made it so clear within seconds. The comparison to a progress bar was the moment when it began to make sence for me 🙂 Thanks!

  43. Dorjee Tsering
    June 23, 2017 at 04:07

    You explained the whole deferred and promise thing in such a simple way. Thank you sir. Though some of the methods used are obsolete now, but is a good stepping stone to understand the new style.

Leave A Comment

You must be logged in to post a comment.