I was writing code that does something that looks like:  function getStuffDone(param) {           | function getStuffDone(param) {     var d = Q.defer(); /* or $q.defer */ |     return new Promise(function(resolve, reject) {     // or = new $.Defer...
I have restructured my code to promises, and built a wonderful long flat promise chain, consisting of multiple .then() callbacks. In the end I want to return some composite value, and need to access multiple intermediate promise results. However th...
Let's say I have a set of promises that are making network requests, of which one will fail:  // http://does-not-exist will throw a TypeError var arr = [ fetch('index.html'), fetch('http://does-not-exist') ]  Promise.all(arr)...
Let's say I have a set of Promises that are making network requests, of which one will fail:  // http://does-not-exist will throw a TypeError var arr = [ fetch('index.html'), fetch('http://does-not-exist') ]  Promise.all(arr)...
I have a loop which calls a method that does stuff asynchronously. This loop can call the method many times. After this loop, I have another loop that needs to be executed only when all the asynchronous stuff is done. So this illustrates what I wan...
I want to run the same action whether my Promise resolved successfully or not. I don't want to bind the same function to both args of .then. Isn't there a .always like jQuery has? If not, how do I achieve this?...
I have to make a sequence of fetch() Promise: I have only 1 url at a time, this means only 1 fetch() promise. Every time I receive a json,this one contains an url for another json, so I have to make another fetch() promise.  I'm able to work wi...
I want to fulfill a promise with some other promise. The point is that I really want to get access to the (still pending) second promise as soon as the first promise is fulfilled. Unfortunately, I only seem to be able to get the second promise'...
Why can't I just throw an Error inside the catch callback and let the process handle the error as if it were in any other scope?  If I don't do console.log(err) nothing gets printed out and I know nothing about what happened. The process ju...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.