TL;DR
We plan to implement the Await Dictionary of Promises proposal in GraalJS. It adds Promise.allKeyed and Promise.allSettledKeyed alternatives for Promise.all and Promise.allSettled, respectively, that allow awaiting a dictionary (rather than array) of promises.
Details
Adds:
Promise.allKeyed(promises)
Promise.allSettledKeyed(promises)
const {
shape,
color,
mass,
} = await Promise.allKeyed({
shape: getShape(),
color: getColor(),
mass: getMass(),
});
const results = await Promise.allSettledKeyed({
shape: getShape(),
color: getColor(),
mass: getMass(),
});
if (results.shape.status === "fulfilled") {
console.log(results.shape.value);
} else {
console.error(results.shape.reason)
}
TL;DR
We plan to implement the Await Dictionary of Promises proposal in GraalJS. It adds
Promise.allKeyedandPromise.allSettledKeyedalternatives forPromise.allandPromise.allSettled, respectively, that allowawaiting a dictionary (rather than array) of promises.Details
Adds:
Promise.allKeyed(promises)Promise.allSettledKeyed(promises)