https://developer.mozilla.org › fr › docs › Web › JavaScript › Reference › Global_Objects › Promise
Promise - JavaScript | MDN - MDN Web DocsL'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 - W3SchoolsHere 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.
Promises in JavaScript represent processes that are already happening, which can be chained with callback functions. If you are looking to lazily evaluate an expression, consider using a function with no arguments e.g. f = () => expression to create the lazily-evaluated expression, and f() to evaluate the expression immediately.
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-basics
Promise - The Modern JavaScript TutorialThe most important, fundamental one is .then. The syntax is: promise.then ( function (result) { /* handle a successful result */ }, function (error) { /* handle an error */ } ); The first argument of .then is a function that runs when the promise is resolved and receives the result.
https://fr.javascript.info › promise-basics
Promesse (promise) - JavaScriptUne 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-api
Promise API - The Modern JavaScript TutorialThe syntax is: let promise = Promise.all(iterable); Promise.all takes an iterable (usually, an array of promises) and returns a new promise. The new promise resolves when all listed promises are resolved, and the array of their results becomes its result.
https://fr.javascript.info › promise-chaining
Chaînage des promesses - JavaScriptLorsqu’un gestionnaire renvoie une valeur, cela devient le résultat de cette promesse. Le prochain .then est appelé avec. Une erreur classique pour les débutants: techniquement, nous pouvons également ajouter plusieurs .then à une seule promesse. Ceci n’est pas le chaînage des promesses. Par example :
https://web.dev › articles › promises
JavaScript Promises: an introduction | Articles - web.devJavaScript Promises: an introduction. Stay organized with collections Save and categorize content based on your preferences. Promises simplify deferred and asynchronous computations. A promise represents an operation that hasn't completed yet. Jake Archibald. Developers, prepare yourself for a pivotal moment in the history of web development.
https://www.javascripttutorial.net › es6 › javascript-promises
JavaScript Promises - JavaScript TutorialJavaScript Promises. Summary: in this tutorial, you will learn about JavaScript promises and how to use them effectively. Why JavaScript promises. The following example defines a function getUsers() that returns a list of user objects: function getUsers() { return [ { username: 'john', email: 'john@test.com' },