Fetch API
MDNs Basic Concepts article is here here. The Lineup will be Basic Concepts, FetchAPI, and UsingFetch MDN's in order.
The Fetch API is at it's heart, an abstraction layer over the HTTP Payloads
- Requests
- Response
- Header
- Body
- Global fetch method
These components get abstracted to Javascript Objects
Other things to note
- Better than XHR(XMLHttpRequest). more efficient and extensible
- Used by the Service Worker API
- Promise-based
The Headers object has a guard feature. It can only be set to 5 values...
- immutable
- request
- request-no-cors
- response
- none
... and it affects set();, delete();, and append();
Ok so after going through the basic concepts we have lots to research.
- Service Worker API
- Promises
- Guard
- http pipeline
- headers object
- set, delete, and append.. how does guard really affect these?
- Using Fetch MDN
- Fetch API MDN
- Understanding the PolyFill
------------------------------------------------------------------
Next up is the FetchAPI MDN page
- Fetch gives a generic definition of Request and Response Objects
- Our GlobalFetch.fetch method has 1 mandatory argument which is the path to the resource(URL) that you want to fetch
- It returns a promise which resolves to the response of the request.
- Once the response is received, we have methods for defining body content.
- You can make Req and Res directly with ();Constructors, but it's more likely be used in Service Workers with FetchEvent.respondWith
The Page ends with 4 interfaces (GlobalFetch, Headers, Request, Response), 1 Mixin for the Body, and a link to the spec
----------------------------------------------------------------------
And last the Using Fetch page