Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
One, foreword
Before the new column begins, thanks to the Nuggets platform:
- Participated in several platform text activities and received prizes;
- Although the output quality is not high, but did develop a good habit of continuous learning;
At present, the following columns have been completed (the first edition is completed) :
- Vue2. X Source Code Study Notes
- VueRouter source Code Study Notes
- Vuex Source Code Study Notes
And design Patterns migrated from the old blog.
Here, thank you for your support and encouragement, as well as your valuable suggestions;
On weekdays, 2 ~ 3 hours of time should be taken out steadily every evening. Under normal circumstances, it can focus on a knowledge point and output a hydrology article.
Note: I have read a lot of excellent articles in the gold digging platform, learn from each other, thank you for a wave ~;
At the end of the preface, from the beginning of this article, enter the Promise source code related knowledge learning and summary;
Two, Promise overview
There are many excellent articles related to gold Digging Promise, if necessary, you can go to the collection under the home page to find it (it seems that there is no archiving for a period of time, it will be more messy).
The original intention of writing this column is to sort out and summarize personal knowledge, mainly focusing on the following two parts:
- Analyze and solve asynchronous problems in development, how to write more elegant code;
- Learn the Promise A+ specification, and implement A Promise library from 0 ~ 1;
Promise has an absolute position in the front end, which will be covered in the interview, including some core design ideas that have been applied in many frameworks; In the implementation of Promise, high-order function, Corrification thought, publish and subscribe mode are reflected.
This article will sort out and split the relevant knowledge points of Promise;
Three, Promise knowledge comb (column directory)
The theme | knowledge |
---|---|
Introduction of Promise | Promise introduction and basic use; Promise vs. callback; The importance and role of promises; Promise usage scenarios: Promisify encapsulation; Promise’s advantages and disadvantages, compatibility; |
Promise simple version implementation | Implement a Promise of simplified functionality |
Promise A + specification | Translate and understand the Promise A+ specification Implement the Promise library according to the Promise A+ specification |
The chain call to Promise | Asynchronous issues in development Use Promise to solve the callback hell problem Promise rules for chain calls The implementation principle of the Promise chain call |
X processing in Promise | X is processed according to the Promise A+ specification |
Promise of the test | Test through promise-aplus-tests |
Promise core method implementation | Resolve (), reject(), catch(), all(), Race (), finally(), any(), allSettled() |
Promisify | Promisify Encapsulation and application scenarios |
generator | Introduction and use of the generator The realization of the generator |
co | Introduction and use of CO The realization of the co |
async/await | Introduction and use of async/await The realization of the async/await |
EventLoop | Introduction to browser event ring |
Promise the interview questions | Often meet test analysis Promise related knowledge summary |
For the time being, the topic in the table will be used as a reference, and the process will continue to refine and expand, such as: penetration problems, usage analysis in different scenarios, programming skills and design patterns in the source code, etc.
Four, the end
In this paper, the relevant knowledge points of Promise are sorted out and split;
As a temporary directory of the column, with the update of the article continues to improve, welcome everyone to leave a message to discuss and supplement;
Next, introduction and Use of Promises;
Maintain a log
- 20211025
- Update column catalog and link: Promise Profile