Questions tagged [promise.all]
104 questions
0
votes
1 answer
Promise wrapping in catch clause and waiting in Promise.all
The documentation for promises states that .catch()returns a promise. Does this mean that if you return a promise in your code it will get wrapped in another promise from the .catch?
i.e.
const x = Promise.reject().catch(() =>…

pzero1
- 103
- 1
- 8
0
votes
1 answer
Fetch multiple urls then set state accordingly React Native
I'm trying to fetch multiple .png images then set my state accordingly.
I've managed to asynchronously fetch all of the urls without using Promise.all; however, the subsequent setstate function was being executed before the promises resolved.…

stuckNconfuzed
- 21
- 2
0
votes
4 answers
How to handle promise.all rejecting one promise out of three promises?
I have a unique situation where 2 promises are running together in Promise.all.
but one of the promise is taking long time and hence I am not getting any result.
Other promise are getting resolved except one.
I want to reject the promise taking long…
0
votes
1 answer
I am trying to make scoring function for my game in spark ar, but promise.all doesn't seems to work
im very new to programming, im trying to use script to patch bridging technique. i have no idea why this doesn't work, here's my code:
const Scene = require('Scene');
const Patches = require('Patches');
export const Diagnostics =…

Ouji Pouji
- 1
- 1
0
votes
0 answers
promise.all waiting time (really tricky for me)
first, here is dummy promise function:
const dummy_server = () => new Promise(resolve => {
setTimeout(() => {resolve('success')}, 3000)
})
the scenario 1 is below:
const result1 = await dummy_server()
const result2 = await dummy_server()
const…

WreewanMorhee
- 77
- 7
0
votes
1 answer
Node JS Promise.all to async update properties in array of JSON objects
I'm new to JS and Node.js and I'm working on a personnal project to translate webVTT subtitle files using Azure Translator API - To do that, I use the node-webvtt npm package to parse / compile the webVTT file. The parsing operation provides a JSON…

timoleo23
- 11
- 2
0
votes
1 answer
Handling reject in Promise.all in jasmine tests
I am trying to test a function containing a Promise.all in jasmine (TypeScript, but I assume I'd have the same problem in JS) - I want to make sure I am handling a rejection appropriately:
function foo(): Promise {
return…

Nicole Stein
- 925
- 1
- 9
- 23
0
votes
2 answers
Nested promise.all
I am try to improve some performance problem and for this I am try to do followings
I have a promises array and I wanna return result of this after all promises at promises array are done.
by the way result of processA, processB and processC are…

Ferhat YALÇIN
- 1
- 3
0
votes
1 answer
Custom function not running asynchronously in Promise.all()
I am trying to run a function 4 times (with different parameters) asynchronously with a Promise.all. This snippet runs, however it will only run each 'loopGridValidate' function in order synchronously. I have replaced the loopGridValidate function…

Austin Areaux
- 31
- 3
0
votes
4 answers
Putting up delay in promises
So, I have two promises that I want to print on screen with a 3sec delay in between. How would I achieve it. Below is the code.
const promiseOne = new Promise(function(resolve, reject) {
resolve("Hello")
});
const promiseTwo = new…

new2coding
- 27
- 1
- 7
-1
votes
0 answers
Using Javascript Promise.all and .then()
I am currently learning how to use JS promises, and specifically in this example, Promise.all to confirm an array of fulfilled promises before using .then() to pass this argument to a callback.
I have completed already a function and am not sure…

Sean.realitytester
- 17
- 8
-2
votes
1 answer
Promise.all inside try-catch block - error not caught
I saw some similar thread on SoF, but they didn't seem to be the exact same thing.
I'm new to javascript, so I might be missing something obvious.
The following code:
async function funcThatThrowsError() {
throw new Error('some…
anon
-2
votes
2 answers
How to refactor this code more optimistically using Promise.all?
How do we implement the below code using Promise.all() ?
I have tried using promise,async/await way. But, this problem requires something to be done using Promise.all()
class Provider{
/*
Gets the weather for a given city
*/
static…

user9151444
- 31
- 1
- 9
-3
votes
1 answer
Verify environment using promise.all()
I have to write Node.js script using promise.all() that will check that environment has docker, git, npm, nvm and node.js. For every tool write to stdout the tool version. If some tools doesn't exist write to stderr message about it and finish…

Mamuka Bzhalava
- 13
- 2