- 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.
- Google Flutter Mobile Development Quick Start Guide
- Mastering Articulate Storyline
- 基于Java技術(shù)的Web應(yīng)用開(kāi)發(fā)
- Modern JavaScript Applications
- JavaScript入門(mén)經(jīng)典
- Kotlin從基礎(chǔ)到實(shí)戰(zhàn)
- Terraform:多云、混合云環(huán)境下實(shí)現(xiàn)基礎(chǔ)設(shè)施即代碼(第2版)
- 21天學(xué)通C++(第5版)
- 詳解MATLAB圖形繪制技術(shù)
- Go語(yǔ)言編程
- Java Web從入門(mén)到精通(第3版)
- .NET 4.5 Parallel Extensions Cookbook
- Go語(yǔ)言從入門(mén)到精通
- Mastering Bootstrap 4
- Developer,Advocate!