Deep understanding of Promise, the core of JS asynchronous programming

In fact, before the emergence of ES6 standard, the community first put forward the Promise scheme. Later, with the addition of ES6, its usage was unified and native Promise objects were provided. Promise basic information If you have to explain what Promise is, it is simply a container that holds the results of an event (usually asynchronou ...

Added by storyboo on Sat, 19 Feb 2022 00:41:09 +0200

Simple implementation of Promise basic method

preface Promise is a very common concept in front-end interview and work. There is also a market for the handwritten implementation of its various methods. Today, I will summarize the simple implementation of promise's basic methods. catch() method The catch method is an encapsulation of the then method and is only used to receive error messag ...

Added by smoked1 on Wed, 02 Feb 2022 09:15:13 +0200

Promise control concurrency in 5 minutes

causeThe project needs to do an upload function, which uploads 20 videos at a time. There will be a blocking problem if it is not transmitted directly.Because a web page can only have 6 tcp connections with the same domain name at most. If you do not control the concurrent transmission of 6 interfaces at the same time, all subsequent operations ...

Added by jaiswal on Mon, 24 Jan 2022 16:34:53 +0200

Front end interview: talk about your understanding of Promise in ES6 and use scenarios

Promise introduction Promise asynchronous programming solution is more reasonable and powerful than the traditional solution (callback function), mainly to solve the problem of callback hell. What is hell? Look at the following code: doSomething(function(result) { doSomethingElse(result, function(newResult) { doThirdThing(newResult, fu ...

Added by brodwilkinson on Sun, 16 Jan 2022 21:14:05 +0200

promise - asynchronous programming tool

This paper understands Promise principle by implementing a simple class, compares Promise with traditional callback, shows Promise's advantages in asynchronous programming, and finally introduces Promise's application in practical development. I concept Promise decouples asynchronous operations from callbacks and associates them through execu ...

Added by broomstick on Tue, 04 Jan 2022 01:22:45 +0200

Node.js SQL database operation (operation of MySQL database and database connection pool)

Node.js MySQL driver Node. The native MySQL driver library of JS is called mysql MySQL L2 project is an upgraded version of the native MySQL driver project. It is compatible with MySQL and supports its main features. It provides new features: Faster and better performancePreprocessing statementExtended support for encoding and collati ...

Added by Aeolus on Sat, 25 Dec 2021 17:08:40 +0200

Promise topic 02 - promise result, basic process of promise, promise API (constructor, then, catch, resolve, reject, all, race), several key issues

1. promise object value promiseResult A property in promise object: [promiseResult] Save the results of the success or failure of the object This value is manipulated by the resolve and reject functions if (xhr.readyState === 4) { if (xhr.status >= 200 && xhr.status < 300) { resolve(xhr.response) ...

Added by vahidf on Fri, 15 Oct 2021 01:16:44 +0300