@akshay-nm/custom-fetch

Wrapper over window.fetch (with abort controller)

Usage no npm install needed!

<script type="module">
  import akshayNmCustomFetch from 'https://cdn.skypack.dev/@akshay-nm/custom-fetch';
</script>

README

Custom Fetch

A wrapper over window.fetch.

usage

yarn add @akshay-nm/custom-fetch

This one attaches an abort signal on window.fetch, and adds a timeout (can be configured by passing a timeoutDuration param).

Parameters supported:

  • url
  • timeoutDuration
  • method
  • headers
  • body
  • mode
  • credentials
  • cache
  • redirect
  • referrer
  • integrity

Returns an object with following properties:

  • send: () => Promise
  • abort: () => Promise