Currently only provides a way to break the loop internally by return end symbol, It would be useful to provide a way to cancel the loop from outside like below.
const cancellablePromise = pForever(async () => {
});
cancellablePromise.cancel();
why i need to cancel a promise from outside? bcz code like below is stupid.π
let loopShouldStop = false;
pForever(async () => {
if (loopShouldStop) return pForever.end;
await doJobA();
if (loopShouldStop) return pForever.end;
await doJobB();
if (loopShouldStop) return pForever.end;
await doJobC();
});
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too