- 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.
- VMware View Security Essentials
- 編程珠璣(續)
- FreeSWITCH 1.6 Cookbook
- Mastering Julia
- WordPress Plugin Development Cookbook(Second Edition)
- 精通Linux(第2版)
- Python深度學習:基于TensorFlow
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰
- 軟件測試實用教程
- Sails.js Essentials
- Microsoft Exchange Server 2016 PowerShell Cookbook(Fourth Edition)
- 零基礎PHP從入門到精通
- Java面試一戰到底(基礎卷)
- Hands-On GUI Application Development in Go
- Head First Go語言程序設計