For more than a decade the Web has used XMLHttpRequest (XHR) to achieve asynchronous requests in JavaScript. While very useful, XHR is not a very nice API. It suffers from lack of separation of concerns. The input, output and state are all managed by interacting with one object, and state is tracked using events. Also, the event-based model doesn’t play well with JavaScript’s recent focus on Promise- and generator-based asynchronous programming.
The Fetch API intends to fix most of these problems. It does this by introducing the same primitives to JS that are used in the HTTP protocol. In addition, it introduces a utility function fetch()
that succinctly captures the intention of retrieving a resource from the network.
The Fetch specification, which defines the API, nails down the semantics of a user agent fetching a resource. This, combined with ServiceWorkers, is an attempt to:
diff --git a/test/test-pages/heise/expected.html b/test/test-pages/heise/expected.html index 101c54e..2fa9197 100644 --- a/test/test-pages/heise/expected.html +++ b/test/test-pages/heise/expected.html @@ -1,5 +1,5 @@