Top "Promise" questions

Promises are a tactic for deferred computing, suitable for several styles of concurrency: thread and event loop concurrency for local computation, and both synchronous and asynchronous remote messaging.

Can you resolve an angularjs promise before you return it?

I am trying to write a function that returns a promise. But there are times when the information requested is …

angularjs promise
Do I need to return after early resolve/reject?

Suppose I have the following code. function divide(numerator, denominator) { return new Promise((resolve, reject) => { if(denominator === 0){ reject("Cannot …

javascript promise es6-promise
Promise.all: Order of resolved values

Looking at MDN it looks like the values passed to the then() callback of Promise.all contains the values in …

javascript promise es6-promise
Using Promises with fs.readFile in a loop

I'm trying to understand why the below promise setups don't work. (Note: I already solved this issue with async.map. …

node.js promise readfile
What is std::promise?

I'm fairly familiar with C++11's std::thread, std::async and std::future components (e.g. see this answer), which …

c++ multithreading c++11 promise standard-library
How to use promise in forEach loop of array to populate an object

I am running a forEach loop on an array and making two calls which return promises, and I want to …

javascript arrays foreach promise es6-promise
Why can I not throw inside a Promise.catch handler?

Why can't I just throw an Error inside the catch callback and let the process handle the error as if …

javascript asynchronous promise throw es6-promise
Is Node.js native Promise.all processing in parallel or sequentially?

I would like to clarify this point, as the documentation is not too clear about it; Q1: Is Promise.all(…

javascript node.js promise es6-promise
How do I promisify native XHR?

I want to use (native) promises in my frontend app to perform XHR request but without all the tomfoolery of …

javascript xmlhttprequest promise
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