js-promise-library
js-promise-library copied to clipboard
MyPromise statics are subject to array manipulation.
Test case 1
const waitP = new MyPromise(r => setTimeout(r, 2000));
const arr = [waitP];
MyPromise.all(arr).then(() => console.log('I am finished'), () => console.log('I failed'));
arr.push(0);
// Observe this never resolves.
Test case 2
const waitP = new MyPromise(r => setTimeout(r, 2000));
const longWaitP = new MyPromise(r => setTimeout(r, 20000000));
const arr = [waitP, longWaitP];
MyPromise.all(arr).then(() => console.log('I am finished WAY before 5 hours'), () => console.log('I failed'));
arr.length = 1;
// Observe this resolves insanely early.