3 ms·
Tip: if you use anything other than fetch you'll just get JSON back immediately based on the MIME type, without the unnecessary conversion step.
by nailer 11y ago
Tip: if you use anything other than fetch you'll just get JSON back immediately based on the MIME type, without the unnecessary conversion step.
- tehbeard 11y agoThose other than fetch()s still do the "unnecessary conversion step". Don't dismiss fetch by the fact it doesn't hand hold or make assumptions. It should be said that fetch() is quite low level call compared to what we've had before regarding ajax, so it makes sense in larger projects to wrap it to keep any logging, error handling and retry in one place.
- nailer 11y ago> it doesn't hand hold or make assumptions Using MIME types isn't hand holding or making an assumption. Yes, people who need the low level features will wrap it with a series of competing high level libraries. It's a missed opportunity to make a standard, capable high level API though.
- moron4hire 11y agoFetch API also doesn't have any means of tracking progress, making it strictly inferior to XmlHTTPRequest
- neoeldex 11y agoFetch does have streaming uploads and downloads, and a quite some other features which doesn't come with xmlHttpRequest. Making it not strictly inferior to XMLHttpRequest
- moron4hire 11y agoWill have. Future tense. Not present tense.
- mathias 11y agoPresent tense: https://domenic.github.io/streams-demo/ https://domenic.github.io/streams-demo/
- nailer 11y agoIn fetch's defence it will in future once the Streams API is finalised: https://github.com/whatwg/fetch/issues/21 https://github.com/whatwg/fetch/issues/21