• Understanding of promise


    What is promise? Including the above: Abstract asynchronous operation tools.In javascript: promise is a constructor (function is also an object) Why promise? 1. If multiple nested asynchronous operations are used directly in the callback mode, it will cause a callback shell2. Promise makes asynchronous operation more standardized and API more unified.3. The complex relationship between […]

  • Loop and asynchronous operation (promise / async / await)


    preface JS has a headache hell callback problem, so there is promise, chain calls, based on promise also appeared a variety of asynchronous solutions, one of the best personal feeling should be async / await solution, has always been vague use, until encountered loop and asynchronous problems, so spent time looking up information from 1 […]

  • Promise from two eyes to double eyes (4) – several key problems of promise (2)


    How promise connects multiple operation tasks Promise’s then() returns a new promise, which connects multiple synchronous / asynchronous tasks through the chain call of then new Promise((resolve, reject) => { setTimeout(() => { console.log (execute task 1 (asynchronous) resolve(1) }, 1000); }).then( value => { console.log (‘result of task 1:’, value) console.log (‘execute task 2 […]

  • Figure out the advantages and disadvantages of each tree


    preface There are two ways to realize data structure, one is sequential storage, the other is chain storage Sequential storage: the use of a continuous piece of logical address to store dataChained storage: use a pointer to the address of the next element instead of a continuous address Common data structures are: linear table, stack, […]

  • “Call back to hell”: promise example of elegant solution


    What is “callback hell” ”Callback hell “is also called” callback pyramid “. When we write code, it is inevitable for JS to call back asynchronouslyFor example, AJAX continues to request data asynchronously, and the callback method also needs to process the data and continue to callback… Forming a callback hellThis will make our code readability […]

  • Promise Basic Edition (prototype)


    function Promise(fn){ //A successful callback is required var self = this var callback; //An instance method used to register asynchronous events self.then = function(done){ callback = done; } //Resolve is executed before then, and the callback does not exist //So add a setTimeout to have the resolve function at the end of the callback queue […]

  • Graphical realization principle of promise (2) — chain call of promise


    This article starts with WeChat official account of vivo Internet technology.Link: https://mp.weixin.qq.com/s/Xz2bGaLxVL4xw1M2hb2nJQAuthor: morrain Many students are learning promise, but they don’t know why. They can’t understand the usage of promise.This series of articles from simple to deep gradually realize promise, and combined with flow chart, examples and animation to demonstrate, to achieve a profound understanding […]

  • Stack-c language implementation of data structure


    Source: http://blog.seclibs.com/ Data In the last article, stack can be divided into sequential stack and chain stack. Sequential stack: stack implemented by array Chain stack: a stack implemented with a linked list Because the stack is a sort of “function limited” sequential list, so in the implementation, the effect can be achieved by modifying the […]

  • Technology sharing | nested transaction, autonomous transaction and chained transaction of MySQL


    Author: Yang Taotao This article is inspired by the recent support for a customer to migrate from Oracle to MySQL. Next weDetailed description of transaction types in MySQL。 classification 1. General affairs A transaction that starts with begin / start transaction and ends with commit / rollback. Or a transaction with a savepoint. 2. Chain […]

  • The realization of data structure by C language: sequential queue, chain queue and circular queue


    Source: http://blog.seclibs.com/ Data…, chain queue, circular queue-c language implementation/ In the last article, we talked about the related contents of queues. In addition to the sequential queues, chained queues and circular queues mentioned in this article, we also mentioned blocking queues and concurrent queues. These two queues have not yet been implemented due to their […]

  • 30 minutes, take you to realize a promise that meets the specification


    preface aboutPromiseThere are many excellent articles on principle analysis in nuggets. But the author is always in theIf you read it, you can write itThis is the purpose of this article, in order to sort it outPromiseWrite a wave of code from scratch, but also facilitate their future review.   The role of promise PromiseyesJavaScriptAsynchronous […]

  • Using Directory.GetFiles Filtering multiple types of files


    The author of the original text does not allow reprint, send a chain here, everybody goes to see. https://codedefault.com/s/how-do-i-call-directory-getfiles-with-multiple-filters-in-csharp-application/   For backup. Here’s a brief idea Directory.GetFiles.Where Use lambda expressions to filter. To be more specific, one is used in where. Endwith, and the other is used in where Regex.IsMatch Regular expression for. For example, […]