Tag:promise

  • Quick Start Get started with Promises in JavaScript

    Time:2022-12-8

    When I was a novice, I read a lot aboutPromiseI have not been able to understand the meaning of the so-called pain points of asynchronous operations in the document introducedIt wasn’t until I turned over all the Chinese documents on the first page of Google that I had an epiphany. In fact, it’s the simplest […]

  • Progressive Interpretation of Promise Source Code (4)

    Time:2022-12-6

    focus onfront end, read more original technical articles Review: Progressive Interpretation of Promise Source Code (1)Review: Progressive Interpretation of Promise Source Code (2)Review: Progressive Interpretation of Promise Source Code (3) Full code + comments, can be read against multiple then concatenation – legacy issues /* Not implemented yet: no less than 2 .then() chain calls*/ […]

  • How to gracefully break a Promise? Let’s try AbortController!

    Time:2022-12-6

    Welcome to the fifth issue of the front-end small class. Today we will talk about how to terminate the ongoingFetchas well asPromise. This article will introduce the two key knowledge points in detail.AbortControllerandAbortSignal. Students who are more interested in hands-on practice can also watch the corresponding video version. In the usual development process, it is […]

  • Frontend – JavaScript Asynchronous Programming Promise

    Time:2022-12-5

    What is Promise Promises are a solution to asynchronous programming. ES6 already provides nativePromiseobject. OnePromiseThe object will be in the following states (fulfilled and rejected will not change once confirmed): Pending: The initial state, neither honored nor rejected. Fulfilled: means the operation completed successfully. Rejected: means the operation failed. basic usage PromiseObject is a constructor […]

  • The problem that Nodejs and Jest unit tests cannot exit normally

    Time:2022-12-4

    recently writingNodejs/JestDuring the unit test, the application cannot exit normally. Obviously the unit test has been executed, but the application is stuck and cannot exit normally, resulting in the unit test not being able to be continuously executed. Due to the complexity of the application, it is difficult to find out what causes it. After […]

  • Progressive Interpretation of Promise Source Code (5)

    Time:2022-12-3

    focus onfront end, read more original technical articles Review: Progressive Interpretation of Promise Source Code (1)Review: Progressive Interpretation of Promise Source Code (2)Review: Progressive Interpretation of Promise Source Code (3)Review: Progressive Interpretation of Promise Source Code (4) Full code + comments, can be read against PromiseThe last article in the source code interpretation series, detailed […]

  • Understanding of Promise and Aysnc and Await

    Time:2022-12-2

    Callbacks and Promises To understand Promise and Aysnc (Aysnc and Await are used together, so Aysnc below contains Aysnc and Await keywords by default), you must first understand the concept of asynchrony in JavaScript. // traditional writing let callback = function(value){ console.log(value) } let result = step1(function (value1) { step2(value1, function(value2) { step3(value2, function(value3) { […]

  • Promise fulfillment

    Time:2022-12-1

    It is best to know the use of promise before understanding the implementation. If not, you can check the relevant documents first. In addition, you also need to understand the event loop, understand macro tasks and micro tasks. accomplish The implementation of Promise only considers resolve, and the idea of ​​reject is almost the same […]

  • You said you can Promise? Then you solve these five problems in the project?

    Time:2022-11-30

    foreword Hello everyone, I am Lin Sanxin,Tell the most difficult knowledge points in the most easy-to-understand wordsis my motto,The foundation is the prerequisite for advancedIt’s my original intention, as we all know, Promise It is very important in our development, I think for Promise The use level can be divided into three levels 1. Master […]

  • Promise.all, Promise.race and ES2020 new feature Promise.allSettled

    Time:2022-11-29

    For more articles, see the official account [Front-end css and js dry goods] Promises are the most exciting feature of Es6, before that people may have used promises through third-party libraries like Bluebird or Q, but it was not until 2015 that it became a standard feature of js.Promise objects represent the completion (or failure) […]

  • The difference between async/await and Promise

    Time:2022-11-28

    Both async/await and Promise are asynchronous methods, and async/await can better handle the then chain async/await usesSynchronous Thoughts Dealing with Asynchronous MethodsChestnut: A problem encountered in the project. When mounted, it is necessary to obtain all alarm types, and then obtain the selected alarm type. The first thing to do is to call getAllAlarmTypeList() first, […]

  • Example of async/await and promise/promise.all

    Time:2022-11-27

    overview promiseprovides for jsconcurrent asynchronousability, havecallback hellThe problem. async/awaitcan make a batchpromiseaccording tosynchronous sequentiallymode to execute (some interface-dependent scenarios have this requirement), and solvecallback hellThe problem. promise.allcan wait for a batchpromiseTaskAll execution completedreturn later, return togetherresult set,Suitable forSubtasks have no interdependencies,butfollow-up tasksdepend onData results of previous subtasksscene. Promise / Promise.all PromiseProvides an asynchronous interface, withresolve/rejectIt […]