Top "Es6-promise" questions

An ES6 Promise is an ECMAScript 2015 object that represents an in-progress asynchronous operation

What is the explicit promise construction antipattern and how do I avoid it?

I was writing code that does something that looks like: function getStuffDone(param) { | function getStuffDone(param) { var d = Q.defer(); /* …

javascript promise q bluebird es6-promise
Are JavaScript ES6 Classes of any use with asynchronous code bases?

What can ES6 Classes provide, as a pattern of organization, to asynchronous code. Below is an example with ES7 async/…

asynchronous ecmascript-6 es6-promise es6-class
How to return many Promises and wait for them all before doing other stuff

I have a loop which calls a method that does stuff asynchronously. This loop can call the method many times. …

javascript promise ecmascript-6 es6-promise
How to return a proper Promise with TypeScript

So I am learning Angular 2 with typescript. I am reaching a point to write a mocking service which (I believe) …

angular typescript es6-promise
Filtering an array with a function that returns a promise

Given let arr = [1,2,3]; function filter(num) { return new Promise((res, rej) => { setTimeout(() => { if( num === 3 ) { res(num); } else { rej(); } }, 1); }); } …

javascript arrays ecmascript-6 es6-promise
How to check if a Promise is pending

I have this situation in which I would like to know what the status is of a promise. Below, the …

javascript promise ecmascript-6 es6-promise
How can I synchronously determine a JavaScript Promise's state?

I have a pure JavaScript Promise (built-in implementation or poly-fill): var promise = new Promise(function (resolve, reject) { /* ... */ }); From the specification, …

javascript promise es6-promise
What do double brackets mean in javascript and how to access them

Situation I have the following function which uses Promise. var getDefinitions = function() { return new Promise(function(resolve) { resolve(ContactManager.request("…

javascript promise es6-promise
How can I fetch an array of URLs with Promise.all?

If I have an array of urls: var urls = ['1.txt', '2.txt', '3.txt']; // these text files contain "one", "…

javascript promise es6-promise fetch-api
fetch: Reject promise with JSON error object

I have an HTTP API that returns JSON data both on success and on failure. An example failure would look …

javascript promise es6-promise fetch-api