Transcript from the "Wrapping Up Promises" Lesson
[00:00:25] Excellent, so what is our problems with our final, or our solution three here, the promise based model? 99% of developers have no idea how these promise objects are working under the hood. They see .then, and they go my thread will return back up to there when future days get filled back in and then call display.
[00:00:46] So far from the truth. Instead, the then's only job of interest is to grab our display function and put it in future data's hidden unfulfillment properties, an array. Debugging becomes super-hard if you do not understand how this is happening under the hood. And unlike traditional asynchronous work, at least there you knew it was weird.
[00:01:07] Here it looks a little bit more meaningful. It masks the complexity, but benefits you understand it. You get a cleaner readable style with pseudo-synchronous code. These then methods being called give you a pseudo-synchronous style and it has a really nice error handling process. It's a really nice error handling process.
[00:01:26] If you go to parse, the second function, there's your error handler function. To be able to call .catch to add more error handling functions or it's an alternative way about handling errors. That's a really, really nice benefit of this model. And we're gonna see how final version at the very end of today, a single weight, doesn't give you as pretty way of handling errors actually.
[00:01:47] It's in theory step back, I guess, maybe not. I would say a step back from this very clean error handling way. Not a step back, but there's a way of handling errors which is perfectly fine. But this kinda I have my air handling function and I have my regular success function.
[00:02:03] That's pretty nice, that's a pretty nice model. All right, good. So promises, Web APIs, the Callback, Microtask Queue, Event loop [LAUGH] allow us to defer our actions until the work, the background heavy lifting work, the long time work, the slow work is completed. And continue running our code line by line in the meantime.