Re: Cancelable promises

>
>
> That design seems far cleaner than adding functionality directly to
> promises, but can it be made JS-ergonomic?
>
>
The question we need to consider when it comes to a general design for
canceling async tasks is this:  how does one offer cancellation when
defining an async task using an async function?

    async function af() {
        // A bunch of awaits in here.
        // How can I allow the initiator to cancel?
    }

Adding a "cancel" method to (some) promises doesn't work for async
functions, but something like the cancellation token approach would.

So again the question is: can we come up with a cancellation-token-style
pattern which is JS-ergonomic?

Received on Sunday, 1 March 2015 14:03:29 UTC