Tag:promise

  • How to Use Ext Ajax in Promise Style and Test It

    Time:2020-2-16

    After translated a blog about how Promise works in a more functional programming way, I tried to build something to make Ext Ajax call to work in Promise style as a practice. ExtPromise is a simple wrapper to Ext.Ajax and Ext.data.Connection to help you do an Ajax call in Promise style instead of passing success/failure […]

  • Asynchronous JavaScript and promise

    Time:2020-1-28

    Asynchronous? I’ve seen it in many placesAsynchronousThis word, but when I didn’t quite understand the concept, I found that I was often regarded as “already clear” (*  ̄  ̄  ̄). If you have a similar situation, it doesn’t matter. Search for the word and you will get a general description. Here, I’ll give you a […]

  • Build the front-end security sense from the process of TS manufacturing promise

    Time:2020-1-4

    Are you still using the star number of NPM to choose dependency? stayNPM security issues erupt at any timeToday, as a front-end developer, we should have the ability to read the source code. It is better to know what we are using, so that we are using the externalnpmIt’s a sense of security when you […]

  • Front end gossip: how to implement a promise?

    Time:2020-1-2

    Front end gossip: how to implement a promise? First of all, what is promise? A promise is an object that may produce a single value some time in the future: either a resolved value, or a reason that it’s not resolved (e.g., a network error occurred). A promise may be in one of 3 possible […]

  • Promise simple implementation

    Time:2020-1-1

    Promise simple implementation Preface As you may know, there are two modes of JavaScript task execution: synchronous and asynchronous. Asynchronous mode is very important. On the browser side, long-time operations (such as Ajax requests) should be executed asynchronously to avoid browser losing response. In asynchronous mode programming, we often use callback functions. If you are […]

  • ES6 promise object

    Time:2019-12-31

    What is 1? First, print the promise object and observe what promise is console.dir(Promise) You know,Promise is a constructor, with reject and resolve functions. Prototype has methods such as then and catch, which indicates that there are two methods for promise objects. Promise constructor is a function passed in 2 how to use it var […]

  • Analysis of the front interview questions and ideas of “today’s headlines”

    Time:2019-12-30

    An article and an interview question Recently, an article called “8 charts to help you see the execution sequence of async / await and promise step by step” attracted my attention. The author uses a front-end interview topic of “today’s headlines” in 2017 as an introduction to explain the implementation reasons of the final results […]

  • The advantages of async / await over promise

    Time:2019-12-29

    Preface The async / await mentioned in the previous “today’s headlines” front-end interview questions and thought analysis reminds me of an article I wrote before, and I would like to share it here. It details what async functions are and their advantages over promise. Reviewing the past and learning the new, the text begins. What […]

  • JS task

    Time:2019-12-28

    Preface Take a look at the code first setTimeout(function() { console.log(‘timeout’); }, 0); new Promise((resolve, reject) => { console.log(‘promise’); resolve(); }).then(function() { console.log(‘then’); }); console.log(‘global’); Output:promise 、global、 then、timeout Macrotasks and microtasks There are two tasks in the V8 implementation: macrotasks script ,setTimeout, setInterval, setImmediate, I/O, UI rendering microtasks process.nextTick, Promises, Object.observe, MutationObserver The implementation process […]

  • promise, async, await, execution order

    Time:2019-12-27

    async can be transformed to promise. So, if we want to understand async, we have to understand promise first. Promise Normally, promise is easy to understand, especially when using like this: promise .then(() => { // }) .then(() => { // }) .then(() => { // }) then after then would make the order of […]

  • Learn and implement a promise

    Time:2019-12-26

    Learn from teacher Ruan Yifeng ECMAScript 6 Introduction to promiseReference promise implementation Promise belongs to micro task, while the simulated promise uses setTimeout and belongs to macro task. Therefore, in some cases, there will be bugs, which need to be noted, such as: setTimeout(‘console.log(1)’) new Promise(resolve=>{ console.log(2) resolve() }).then(_=>{ console.log(3) }) The correct result should […]

  • [making wheels] manual packaging Ajax (III) – final version

    Time:2019-12-25

    introduction Before you start, think about how Ajax works Open a connection first send data Return result What are the settings we want to customize Set request method Set request header Format return data Return after success or failure What are the functions we need to do data verification Unified data format Support file upload […]