liveBook · Manning

API stability

As explained in Vanilla Web

A stable API is a web API whose behavior and availability are sufficiently established for dependable use across supported browsers.

API stability is a browser-compatibility decision: build core behavior on APIs that are dependable across supported browsers, and treat limited or experimental support as a reason to provide a fallback. section 2.2.1

Use support status to guide implementation:

  • Rely on stable APIs such as Fetch, Web Storage, and Geolocation for core behavior. section 2.2.1
  • Add experimental APIs as progressive enhancements, and use feature detection when support may vary. section 2.2.1
if ('permissions' in navigator) {
   navigator.permissions.query({name: "geolocation"})
        .then(console.log);
}

Check for the Permissions API before querying it; feature detection lets the application handle its absence. section 2.2.1

How Vanilla Web covers it

How deep it goes
Distinguishes API support categories and recommends progressive enhancement and feature detection, without detailing API internals.
Examples
Names Fetch, Web Storage, and Geolocation as stable APIs and demonstrates checking for the Permissions API.
What you can do after
Evaluate API support with Baseline, MDN, or Can I Use, then guard optional features with feature detection.
How it connects
Connects API stability to browser compatibility, feature detection, and progressive enhancement.

Also explained in

Compare how 2 books explain API stability →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vanilla Web. The section links point to the parts of the book it draws on.