@httpc/kit
Version:
httpc toolbox for building function-based API with minimal code and end-to-end type safety
22 lines (21 loc) • 749 B
JavaScript
let fetch;
let Headers;
let Request;
let Response;
(function (global) {
({
fetch,
Headers,
Request,
Response,
} = global || {});
//@ts-ignore
}(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof global !== 'undefined' ? global : this));
if (!fetch) {
throw new Error("Missing fetch API. Be sure fetch is available from the global object or polyfill it (es: with 'cross-fetch' module)");
}
if (!Headers || !Request || !Response) {
throw new Error("Missing fetch API components. Be sure fetch related classes (Request, Response, ...) are available from the global context");
}
//@ts-ignore
export { fetch, Headers, Request, Response };