Might be a naive question, but how does this compare to existing Promise libraries that have cancellation (like bluebird)?
Here's an example: in Bluebird, cancelation doesn't
propagate upstream. After registering onCancel in a
promise constructor, you have to call .cancel() on
that exact promise object. Calling .cancel() in any
child promise created with .then() or .catch() will
not abort the work, rendering the feature useless for
the most common use case!
True cancelation must propagate upstream, prevent
all pending work, and immediately free resources and memory.
From the README As an optimization, the cancellation signal propagates
upwards the promise chain so that an ongoing operation e.g.
network request can be aborted.Unfortunately it's still not viable in the browser due to its size, promises too easily get converted into non-cancelables, and worst of all, async/await forces native promises. If you want cancelable coroutines, you're forced to roll a generator-based implementation such as what Posterus provides.
Kind of answered in another subthread: https://news.ycombinator.com/item?id=14963524