Région de recherche :

Date :

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

Promise - JavaScript | MDN - MDN Web Docs

L'objet Promise (pour « promesse ») est utilisé pour réaliser des traitements de façon asynchrone. Une promesse représente une valeur qui peut être disponible maintenant, dans le futur voire jamais. Note: Cette fonctionnalité est disponible via les Web Workers.

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://developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

The Promise() constructor is used to create the promise. The fulfillment of the promise is logged, via a fulfill callback set using p1.then() . A few logs show how the synchronous part of the method is decoupled from the asynchronous completion of the promise.

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

Utiliser les promesses - JavaScript | MDN - MDN Web Docs

Une promesse est un objet (Promise) qui représente la complétion ou l'échec d'une opération asynchrone. La plupart du temps, on « consomme » des promesses et c'est donc ce que nous verrons dans la première partie de ce guide pour ensuite expliquer comment les créer.

https://masteringjs.io › tutorials › fundamentals › promise-create

JavaScript Create Promise - Mastering JS

In general, there are 4 ways to create a new promise in JavaScript: Using the Promise constructor. Using the static helpers Promise.resolve() and Promise.reject() Chaining with the then() function or catch() function. Call an async function. Using the Promise Constructor. The Promise constructor takes a single parameter, an executor function.

https://fr.javascript.info › promise-basics

Promesse (promise) - JavaScript

Une promesse (promise) est un objet spécial en JavaScript qui lie le “producteur de code” et le “consommateur de code” ensemble. En comparant à notre analogie c’est la “liste d’abonnement”.

https://javascript.info › promise-basics

Promise - The Modern JavaScript Tutorial

A 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 ...

https://zestedesavoir.com › tutoriels › 446 › les-promesses-en-javascript

Les promesses en JavaScript • Bibliothèque - Zeste de Savoir

Concrètement, les promesses vont permettre plusieurs choses : Ne plus se perdre dans les callbacks imbriqués. Pouvoir faire des traitements asynchrones de manière simultanée tout en récupérant les résultats une seule fois simplement.

https://www.freecodecamp.org › news › how-to-use-promises-in-javascript

Asynchronous JavaScript – How to Use Promises in Your JS Code

Promises are a powerful tool in JavaScript for managing asynchronous operations, providing a cleaner and more organized approach to handling asynchronous code. Here's what we'll cover: What is asynchronous JavaScript? The need for promises. What is callback hell? How to create a promise. How to consume promises with .then() and .catch()

Asynchronous JavaScript – How to Use Promises in Your JS Code

https://web.dev › articles › promises

JavaScript Promises: an introduction | Articles - web.dev

Promises simplify deferred and asynchronous computations. A promise represents an operation that hasn't completed yet.