Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Fetch API an ECMAscript feature?

Tags:

I've looked through the MDN resources here as well as here, as well as the WhatWg Fetch Spec, and for all that I can't figure out if the Fetch API is part of ECMAScript 5, 6, 7 or otherwise.

All I can tell is that it isn't implemented consistently across browsers, and in some cases is not supported at all.

Yet the spec definitely defines Fetch as Javascript:

The Fetch Standard also defines the fetch() JavaScript API

Source: link

Is the Fetch API simply a proposal that is not on the books yet for ES 7/8, or is it actually part of ES6/7/8 and my Googling skills have failed me?

like image 559
Ben Avatar asked May 18 '17 22:05

Ben


People also ask

What is fetch API in JavaScript?

The Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network.

Is fetch standard JavaScript?

importScripts() JavaScript APIs. The Fetch Standard provides a unified architecture for these features so they are all consistent when it comes to various aspects of fetching, such as redirects and the CORS protocol.

Is fetch API same as REST API?

The Fetch API is a simpler, easy-to-use version of XMLHttpRequest to consume resources asynchronously. Fetch lets you work with REST APIs with additional options like caching data, reading streaming responses, and more. The major difference is that Fetch works with promises, not callbacks.

What is ES6 API?

Reflect API in ES6 allows us to inspect, or modify classes, objects, properties, and methods of a program at runtime. The Reflect API provides global Reflect object which has static methods that can be used for introspection. These methods are used to discover low level information about the code.


2 Answers

No. It's part of the Web platform API defined by the standards bodies WHATWG and W3C.

The various objects that implement the Fetch API are "host objects". i.e. objects exposed to userland JavaScript that are provided by the application hosting the runtime (usually a browser).

like image 137
Ben Aston Avatar answered Sep 19 '22 14:09

Ben Aston


No. Most of the BOM (BrowserObjectModel) which is exposed by window object are part of WHATWG and W3C. example: navigator, ajax, fetch, etc.,

The spec for Fetch is present https://fetch.spec.whatwg.org/

If you want references in w3c look for Service Worker and search for the term http fetch

ECMASCript features will be listed in ECMA spec https://www.ecma-international.org/ecma-262/7.0/index.html

Note: BOM itself is an informal term

like image 25
karthick Avatar answered Sep 19 '22 14:09

karthick