Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can a fetch be aborted by the initiator? #33

Closed
mislav opened this issue Nov 13, 2014 · 2 comments
Closed

Can a fetch be aborted by the initiator? #33

mislav opened this issue Nov 13, 2014 · 2 comments

Comments

@mislav
Copy link
Contributor

mislav commented Nov 13, 2014

The spec says:

A response can have an associated termination reason which is one of end-user abort, fatal, and timeout.

By "end-user" I presume it means the user who's browsing the web page that's using fetch (possibly by hitting Esc or closing the page?). But what interests me is: can the request be aborted from the same code that initiated it, for the purpose of e.g. aborting a request when it's being replaced with a newer request as a result of repetitive user interaction such as keystrokes in an input field?

If not, what are our options for discarding the outcome of a fetch that we're not interested in anymore? Thanks

/cc @annevk

@dgraham
Copy link
Contributor

dgraham commented Nov 13, 2014

This is a good question. The only uses of jQuery's $.ajax that we haven't been able to replace with window.fetch on github.com are the abort-current-request-replace-with-new-request scenarios.

@mislav I wonder if you should open this issue over at https://github.com/whatwg/fetch instead of here? That repo is where the spec is being written.

@annevk
Copy link

annevk commented Nov 13, 2014

Either that or email the WHATWG list. I suspect we might end up putting a method on Request. It's a bit unclear still what the desirable pattern for cancelable promises is.

@dgraham dgraham closed this as completed Nov 13, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants