3 ms·
What is the difference between XHR-inject and FETCH-inject? Isn't it that the second simply uses the fetch api and is more modern? But everything could be done
by tpetry 9y ago
What is the difference between XHR-inject and FETCH-inject? Isn't it that the second simply uses the fetch api and is more modern? But everything could be done with XHR too?
- bfred_it 9y agoYes. I don't see anything in its code that can't be done without fetch.
- dak1 9y agoYes, fetch is basically sugar around XHR. This is just XHR injection using a nice API in the library itself (which some browsers still don't support). From a user's perspective, you could create the exact same experience using vanilla XHR (which is exactly what AMD module loading does with `define`).
- hdhzy 9y ago> Yes, fetch is basically sugar around XHR. Believe it or not but currently it's actually the other way around: XHR is defined in terms of fetch: > XHR is now defined in terms of fetch (see the calls to fetch in XHR's .send()), meaning fetch is lower level than XHR. Source: https://jakearchibald.com/2015/thats-so-fetch/ https://jakearchibald.com/2015/thats-so-fetch/ and https://xhr.spec.whatwg.org/#the-send%28%29-method https://xhr.spec.whatwg.org/#the-send%28%29-method