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

abort the request #2

Closed
satouriko opened this issue Nov 10, 2018 · 2 comments
Closed

abort the request #2

satouriko opened this issue Nov 10, 2018 · 2 comments

Comments

@satouriko
Copy link

Nowadays the fetch API accepts a signal to cancel the request, being available in edge 16 (2017-10-17), firefox 57 (2017-11-14), chrome 67 (2018-05-29), and later.

How's it going on here?

@kirainmoe
Copy link
Contributor

let abortController = new AbortController();
let signal = abortController.signal;

honoka("http://somewhere", { signal }).then(res => {
    // ...
}).catch(e => {
    console.log(e);
});

abortController.abort();

returns:

Uncaught (in promise) DOMException: The user aborted a request.

It works on Chrome 70.0.3538.77, but not on Safari 11.2.1 (macOS High Sierra 10.13.6) (however demo provided by MDN isn't working either...). Tested current version of honoka.

@satouriko
Copy link
Author

I guess at least the doc and type defination needs updating. qwq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants