From c873843dc8cbdb4d5af652a99476e90515133ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 23 May 2018 16:15:48 +0200 Subject: [PATCH] Polish documentation for aborting requests --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a5958315..ff3e5e7f 100644 --- a/README.md +++ b/README.md @@ -266,17 +266,17 @@ Firefox < 32, Chrome < 37, Safari, or IE. This polyfill supports [the abortable fetch API](https://developers.google.com/web/updates/2017/09/abortable-fetch). However, aborting a fetch requires use of two additional DOM APIs: -[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) -and +[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) and [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). Typically, browsers that do not support fetch will also not support -AbortController or AbortSignal. Consequently, you will need to include an -additional polyfill for these APIs to abort fetches. - -Once you have an AbortController and AbortSignal polyfill in place, you can -abort a fetch like so: +AbortController or AbortSignal. Consequently, you will need to include +[an additional polyfill](https://github.com/mo/abortcontroller-polyfill#readme) +for these APIs to abort fetches: ```js +import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only' +import {fetch} from 'whatwg-fetch' + const controller = new AbortController() fetch('/avatars', { @@ -288,7 +288,7 @@ fetch('/avatars', { }) // some time later... -controller.abort(); +controller.abort() ``` ## Browser Support