Open tobiastom opened 8 years ago
Thank you for this issue!
Sounds reasonable. I need to check the direction of standard cancelable promise proposal in order to think proper API. https://github.com/tc39/proposals#readme
I fear there is no standard for it…
Thanks for considering it!
Sadly, the standard of cancelable promises has been withdrawn :cry: . I will consider my own spec.
https://github.com/tc39/proposals/commit/37e3c5a157e7b3a8211e2e0bb85c9f612b0f04fc
I don't think we need to use Promise cancellations for this one. Seems a little extreme and not backwards-compatible.
How about keeping a list of processes that are running, and providing a way to exit/kill them all?
There's always https://github.com/sindresorhus/p-cancelable
I don't think that the promise.cancel
method is the right direction.
Browsers use AbortController to abort asynchronous operations. This has been standardized already. ECMAScript is following that, cancellation API is discussing (yes, resumed it!) in https://github.com/tc39/proposal-cancellation. It will be similar to AbortController
but not depend on DOM API.
I'm trying to use the Node API to keep some tasks running in the background, while other tasks are performed. Once the other tasks are finished, I'd like to abort all promises which did not finish.
It looks like there is the
abortTasks
function, but it's not exposed as a public API.It would be nice if that could be changed. :)