JS Fetch API

no aborting for you

Working with modern browsers really is the best. Babel works well enough, but nobody wants to transpile their code — it's just a necessary evil. Right? Well, not so much any more. As I write this, nearly all ES6 features are available in the latest versions of Chrome, Firefox, Opera, Safari and Edge.

It's not just ES6 that's coming of age; the fetch API has been implemented in Chrome, Edge, Firefox, and Opera. Like straight ES6, fetch is great for throwing together quick projects when browser support isn't important. It's a vast improvement over the old XMLHttpRequest API. So far, my only complaint with fetch is that the specification doesn't yet include any way to abort requests. I found myself needing this functionality pretty quickly, and usually do whenever I'm working on a project that requires significant client-side state.

Experimental web technologies come and go; I wrote an app that used Web SQL (still supported in Chrome, Safari, and Opera!) but that didn't last long. It can be dangerous to jump on the bandwagon too soon. However, the fetch API looks like it's here to stay, and if browser support really is a big deal, I'd recommend a polyfill. If you do need to cancel requests, I recently used the axios package and it's great.