- Mastering JavaScript Promises
- Muzzamil Hussain
- 153字
- 2021-07-16 13:46:49
Callback, revisited
In previous chapters, you learned how the JavaScript mechanism works. The single-threaded model of JavaScript has its limitation, which can be controlled through better use of callbacks. However, the scenarios such as callback hell really pushed engineers to find and implement a better way to control the callbacks and maximize the performance of the program, while staying inside a single thread. A callback is a function that can be passed as an argument to another function to be executed when it's called.
There is absolutely no harm in using callbacks, but there are also a number of other options available to handle asynchronous events. Promise is one such way to handle asynchronous events and has more efficiency than many of other asynchronous tools in its family.
To understand more clearly why we needed to implement Promises.js in asynchronous programming, we need to understand the concept behind the promise and deferred objects.
- Go Web編程
- Spring 5.0 By Example
- 少年輕松趣編程:用Scratch創作自己的小游戲
- HTML5 移動Web開發從入門到精通(微課精編版)
- C語言程序設計基礎與實驗指導
- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- Mastering ServiceNow(Second Edition)
- 精通Python設計模式(第2版)
- H5頁面設計:Mugeda版(微課版)
- Scientific Computing with Scala
- Apache Kafka Quick Start Guide
- Java Web開發就該這樣學
- 精通MySQL 8(視頻教學版)
- Visual Basic程序設計(第三版)
- C語言程序設計