- Mastering JavaScript Promises
- Muzzamil Hussain
- 174字
- 2021-07-16 13:46:48
The promises object
The promises object is the last of the major concepts of asynchronous programming model implemented. We will be looking at promise as a design pattern.
Promise is a relatively new concept in JavaScript, but it's been around for a long time and has been implemented in other languages.
Promise is an abstraction that contains two main properties, which make them easier to work with:
- You can attach more than one callback with a single promise
- Values and states (errors) get passed along
- Due to these properties, a promise makes common asynchronous patterns using callback easy
A promise can be defined as:
A promise is an observable token given from one object to another. Promises wrap an operation and notify their observers when the operation either succeeds or fails.
The source of this definition is Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley Professional.
Since the scope of this book revolves around the promise and how it is implemented, we will discuss it in greater detail in Chapter 3, The Promise Paradigm.
- 實用防銹油配方與制備200例
- Django Design Patterns and Best Practices
- Java Web開發技術教程
- iOS應用逆向工程(第2版)
- RESTful Java Web Services(Second Edition)
- Hands-On GUI Programming with C++ and Qt5
- Hands-On JavaScript for Python Developers
- C語言程序設計與應用(第2版)
- PHP+MySQL動態網站開發從入門到精通(視頻教學版)
- 30天學通C#項目案例開發
- STM8實戰
- The Statistics and Calculus with Python Workshop
- SQL Server 2014 Development Essentials
- 深入大型數據集:并行與分布化Python代碼
- Java EE應用開發及實訓