question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bliss.fetch doesn't expose the xhr, so cannot call abort()

See original GitHub issue

Hi, I’d like to sometimes abort an ongoing HTTP request, by calling xhr.abort(). But Bliss.fetch() returns a Promise only, via which I cannot access xhr.abort() ( https://github.com/LeaVerou/bliss/blob/gh-pages/bliss.shy.js#L374 )

What do you think about somehow making xhr.abort() accessible? or the whole xhr.

And how can that best be done? My first thought was to add an abort() function on the returned promise, but that doesn’t work so well, because it disappears when chaining with .then(...).

(Currently I’ve done a quick hack in bliss.shy.js: I added xhr as a field on the promise, although it disappears when calling then().)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kajmagnuscommented, Sep 7, 2017

Closing this then, since the PR got merged. B.t.w. now I’ve ported the essential parts of my app from jQuery, to mainly React, + some Bliss also :- )

0reactions
kajmagnuscommented, Jul 19, 2017

Ok, I’ll do :- ) … (a week later) Done, see PR referenced below:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aborting does not abort the XHR · Issue #663 · github/fetch
The onabort event handler returns an AbortError per the Fetch spec, but it doesn't cancel the network activity as it's required to.
Read more >
How to abort XMLHttpRequest if taking a lot of time to load?
To abort simply use xhr.abort() method and it will cancel your request. Also as you don't want it to cancel unless it's working...
Read more >
Cross-domain AJAX using Flash · Curiosity is bliss
You can look at the source of the page for the detailled APIs exposed by the Flash object, the main ones being "fs.XmlHttp(urlString, ......
Read more >
How to Abort a Fetch Request - YouTube
There will be times when you want to tell the browser to stop a fetch call. We can achieve this with an AbortController....
Read more >
Aborting a fetch request
An abortable XHR request looks something like this. let xhr = new XMLHttpRequest(); xhr.method ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found