javascript - Promise.allSettled in babel ES6 implementation -
i'm using babel
transpile node.js@0.10.x
code , i'm stuck promises.
i need allsettled
-type functionality use in q
, bluebird
or angular.$q
example.
on babel's core-js promise
, there no allsettled
method.
currently i'm using q.allsettled
workaround:
import { allsettled } 'q';
is there in babel polyfill? alternatively, algorithm me try implement?
alternatively, algorithm me try implement?
- create new promise executor function
- use counter/result array in scope of executor
- register then() callback each parent promise saving results in array
- resolve/reject promise step 1 when counter indicates parent promises done
Comments
Post a Comment