https://javascript.info › promise-basics
Promise - The Modern JavaScript TutorialA promise is a special JavaScript object that links the “producing code” and the “consuming code” together. In terms of our analogy: this is the “subscription list”. The “producing code” takes whatever time it needs to produce the promised result, and the “promise” makes that result available to all of the subscribed code ...
Підіб’ємо проміжні підсумки: функція-виконавець виконує задачу (щось, що як правило потребує часу), потім викликається один з методів resolve чи reject, в залежності від успішності виконання коду.
promise callback; promise 允许我们按照自然顺序进行编码。首先,我们运行 loadScript,之后,用 .then 来处理结果。: 在调用 loadScript(script, callback) 时,我们必须有一个 callback 函数可供使用。 换句话说,在调用 loadScript 之前,我们必须知道如何处理结果。: 我们可以根据需要,在 promise 上多次调用 .then。
The initial promise resolves in 1 second (*), Then the .then handler is called (**), which in turn creates a new promise (resolved with 2 value). The next then (***) gets the result of the previous one, processes it (doubles) and passes it to the next handler. …and so on.
https://www.w3schools.com › Js › js_promise.asp
JavaScript Promises - W3SchoolsPromise How To. Here is how to use a Promise: myPromise.then ( function (value) { /* code if successful */ }, function (error) { /* code if some error */ } ); Promise.then () takes two arguments, a callback for success and another for failure.
https://www.javascripttutorial.net › es6 › javascript-promises
JavaScript Promises - JavaScript TutorialIn this tutorial, you will learn about JavaScript promises and how to use them effectively in asynchronous programming.
https://www.youtube.com › watch
JavaScript Promises In 10 Minutes - YouTubePromises allow you to write clean non-callback-centr... ES6 came with many new features, but one of the best features was the official introduction of Promises.
https://github.com › kriskowal › q
GitHub - kriskowal/q: A promise library for JavaScriptOur wiki contains a number of useful resources, including: A method-by-method Q API reference. A growing examples gallery, showing how Q can be used to make everything better. From XHR to database access to accessing the Flickr API, Q is there for you.
https://www.youtube.com › watch
JavaScript Promises -- Tutorial for Beginners - YouTubeJavaScript Promises and all their glory! This is episode 12 in a 10 part series I’m calling 10 things Javascript Developers Should Know But Probably Don't.
https://www.freecodecamp.org › news › javascript-promise-tutorial-how-to-resolve-or-reject...
JavaScript Promise Tutorial – How to Resolve or Reject Promises in JSPromises are important building blocks for asynchronous operations in JavaScript. You may think that promises are not so easy to understand, learn, and work with. And trust me, you are not alone! Promises are challenging for many web developers, even after spending years working with them.
https://learnjavascript.online › topics › promises.html
Promises tutorial - Learn JavaScriptSo, what are promises in JavaScript? A promise is an object that represents the eventual completion or failure of an asynchronous operation. You create that object with the new Promise() constructor.
https://developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Using_promises
Using promises - JavaScript | MDN - MDN Web DocsA Promise is an object representing the eventual completion or failure of an asynchronous operation. Since most people are consumers of already-created promises, this guide will explain consumption of returned promises before explaining how to create them.
https://javascript.info › promise-chaining
Promises chaining - The Modern JavaScript TutorialThe initial promise resolves in 1 second (*), Then the .then handler is called (**), which in turn creates a new promise (resolved with 2 value). The next then (***) gets the result of the previous one, processes it (doubles) and passes it to the next handler. …and so on.