Région de recherche :

Date :

https://stackoverflow.com › questions › 40735418

javascript - Return promise from the function - Stack Overflow

A Promise tells you that it will execute at some point in time, without telling you when. The then chain will execute whenever the Promise resolves. You can see that in more detail in returnPromise. Here we return a new Promise.

https://developer.mozilla.org › fr › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

Renvoie un objet Promise qui est rompue avec la raison donnée. Promise.resolve(valeur) Renvoie un objet Promise qui est tenue (résolue) avec la valeur donnée.

https://stackoverflow.com › questions › 29516390

How can I access the value of a promise? - Stack Overflow

Return a value → PromiseB is resolved immediately, and the value is passed to the success handler of promiseB. Return a promise → When resolved, promiseB will be resolved. When rejected, promiseB will be rejected. The value passed to the promiseB's then handler will be the result of the promise.

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

Learn how to use the Promise object to handle asynchronous operations in JavaScript. A Promise represents the eventual completion or failure of an operation and its resulting value.

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Using_promises

Using promises - JavaScript | MDN - MDN Web Docs

Since most people are consumers of already-created promises, this guide will explain consumption of returned promises before explaining how to create them. Essentially, a promise is a returned object to which you attach callbacks, instead of passing callbacks into a function.

https://developer.mozilla.org › fr › docs › Web › JavaScript › Guide › Using_promises

Utiliser les promesses - JavaScript | MDN - MDN Web Docs

Promise.resolve() et Promise.reject() sont des méthodes qui permettent de créer des promesses déjà tenues ou rompues. Promise.all() et Promise.race() sont deux outils de composition qui permettent de mener des opérations asynchrones en parallèle.

https://www.w3schools.com › Js › js_promise.asp

JavaScript Promises - W3Schools

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. Both are optional, so you can add a callback for success or failure only.

https://www.freecodecamp.org › news › javascript-promise-tutorial-how-to-resolve-or-reject...

JavaScript Promise Tutorial – How to Resolve or Reject Promises in JS

A Promise is a special JavaScript object. It produces a value after an asynchronous (aka, async) operation completes successfully, or an error if it does not complete successfully due to time out, network error, and so on. Successful call completions are indicated by the resolve function call, and errors are indicated by the reject function call.

JavaScript Promise Tutorial – How to Resolve or Reject Promises in JS

https://javascript.info › promise-basics

Promise - The Modern JavaScript Tutorial

The function delay(ms) should return a promise. That promise should resolve after ms milliseconds, so that we can add .then to it, like this:

https://javascript.developpez.com › actu › 146280 › Comprendre-les-Promises-en-JavaScript...

Comprendre les Promises en JavaScript / TypeScript

Cet article a pour but de présenter un peu plus posément et en détail les Promises (ou Promesses en français), un concept qui avait été déjà abordé dans un article que j'avais traduit en 2015 : Le futur de l'asynchrone en JavaScript.

Comprendre les Promises en JavaScript / TypeScript