Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Fetch convenience wrapper #3

Closed
peterboyer opened this issue Nov 8, 2021 · 0 comments
Closed

Fetch convenience wrapper #3

peterboyer opened this issue Nov 8, 2021 · 0 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@peterboyer
Copy link
Owner

Similar idea to #2, however because fetch is so commonly poly-filled etc, perhaps this should offer a factory function that accepts fetch as well as a default that attempts to use window.fetch (as offered by the global environment).

// default exported `fetch` as from `Fetch(fetch)`.
import { fetch } from `@armix/terror/fetch`;
const $response = await fetch("/api/...", { options });

// create from your own polyfill and wrap with `Fetch(...)`
import { Fetch } from `@armix/terror/fetch`;
import { fetch as _fetch } from "fetch-polyfill";
export const fetch = Fetch(_fetch);
const $response = await fetch(...);
@peterboyer peterboyer added the enhancement New feature or request label Nov 8, 2021
@peterboyer peterboyer added the wontfix This will not be worked on label Jan 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant