Tag:Generator

  • Using continuum continuation to implement generator in Ruby

    Time:2019-12-21

    There are many classic drive structures in ruby, such as enumerator and generator. This article briefly introduces the concept of generator. Generator is to generate an object at a time according to the functional requirements, or called the method of generating an object. Continuum in Ruby can be used to complete the generator’s functions. Continuum […]

  • JavaScript asynchronous programming: callback, promise, generator

    Time:2019-12-14

    Synchronous and asynchronous Students who understand JavaScript must be familiar with the concepts of synchronization and asynchrony. If there are still unfamiliar students, I’ll give you an example. For example, we have to do three things after getting up in the morning: boiling water, washing face and eating breakfast. Synchronization is equivalent to boiling water […]

  • Ajax fetch and Axios (continuously updated…)

    Time:2019-12-9

    Ajax fetch and Axios (continuously updated…) Sorting out knowledge points AJAX is not the specification of JavaScript, it is just an abbreviation of “invention” of a friend: asynchronous JavaScript and XML, which means to execute asynchronous network requests with JavaScript. Javascript code is executed by single thread. Due to this “defect”, all network operations and […]

  • Use form create to easily generate high-quality form forms [with schematic diagram]

    Time:2019-12-9

    form-create The form generator with the functions of dynamic rendering, data collection, verification and submission supports two-way data binding, event extension and custom components. It can quickly generate 17 functional components including provincial and urban three-level linkage, time selection and date selection. Compatible with iview2And iview3.Edition GitHub documents welcome to collect, like and support. <br/> […]

  • JavaScript asynchronous process control

    Time:2019-11-23

    JavaScript features JavaScript belongs to single thread language, that is, at the same time, only one task can be executed. When executing tasks, all tasks need to be queued, and the last task will be executed only when the previous task is finished. When we send a request to the background, after the main thread […]

  • Some knowledge about JavaScript ES6 (/ let, const / arrow function / promise / generate)

    Time:2019-11-21

    What is ES6? ECMAScript is an internationally adopted standardized scripting languageJavaScript consists of ES, BOM and DOMES is the language specification of JavaScript, and JavaScript is the implementation and extension of ES6 is the next generation standard of JavaScript language Some knowledge about ES6 1.let、const The scopes in Es5 are: function scope, global scopeES6 adds […]

  • Front end asynchronous solution-4.1 (generator)

    Time:2019-11-19

    Preface Finally, I started to write the generator, which is a step closer to the end of this series. In fact, I’m still in a state where I can use the generator but don’t understand the principle, but it’s easy to forget if I don’t summarize the knowledge and record it, so I still record […]

  • “JS” fast start asynchronous scheme

    Time:2019-11-18

    Problem: solve the problem of deep nesting of asynchronous callbacks 1. Promise promiseObject is used to represent the final state of an asynchronous operation,promiseA reliable intermediate mechanism is provided between the callback code and the asynchronous code that will perform the task to manage the callback. //Constructor, callback function is synchronous callback new Promise(function(resolve,reject){ … […]

  • Front end asynchronous solution-4.2 (Generator + Promise)

    Time:2019-11-17

    Why the combination of generator and promise?Most of the articles on the Internet are for the sake of simpler handling of errors, but I haven’t realized this yet, but I think it’s almost the same. But let’s learn the usage first;Let’s start with a simple usage: //Simplest usage function request() { return new Promise(function (resolve, […]

  • Summarize six ways of asynchronous programming

    Time:2019-11-15

    Asynchronous programming As we all know, JavaScript isSingle threadWork, that is, only one script can execute the next script after it is executed. Two scripts cannot execute at the same time. If a script takes a long time, the latter scripts must be queued and waiting, which will delay the execution of the whole program. […]

  • JavaScript asynchronous programming

    Time:2019-11-7

    Preface From the beginning of learning JavaScript, we heard a saying: JS is single threaded, inherently asynchronous, suitable for IO intensive, not suitable for CPU intensive. However, most JavaScript developers have never seriously thought about how and why asynchrony occurs in their programs, nor explored other ways to deal with asynchrony. So far, there are […]

  • Asynchronous request callback nesting solution

    Time:2019-10-26

    Preface In front-end asynchronous requests, to get data, the traditional writing method is Ajax callback, but this methodIt is not conducive to code maintenance and readability, so in the era of ES6, this problem was solved through generator and promise, and ES7 made it more concise through async and await. Nested by generator instead of […]