Skip to content

Simple cancellation is awkward #3

@zenparsing

Description

@zenparsing

Cancel tokens seem to work really well for complex scenarios, but for really simple use cases, the API is awkward for the user. It takes too many lines of code to do the simple thing.

let cancel;
let token = new CancelToken(c => cancel = c);
fetch("some-data.json", token).then(response => {
    // ...
});
cancel();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions