Minimal cancellable fetch wrapper (~600 bytes gzipped) providing a familiar fetch-like API over XMLHttpRequest. Current version 1.0.2 is stable with infrequent releases. Differentiators: tiny size, explicit cancellation via exposed XHR object, IE8+ support (with Promise polyfill). Alternative to unfetch or native fetch when cancellation is required.
npm install xhfetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a cancellable GET request with timeout using createRequest, including abort handling.
Move all parameters (URL, init) to createRequest, not .fetch().
Use credentials: 'include' only when needed; omit for same-origin requests without cookies.
Use only documented methods; avoid methods like response.arrayBuffer() (not supported).
const { fetch } = createRequest(url); const result = await fetch();Use only createRequest API, not window.fetch.
Include a Promise polyfill like es6-promise or core-js.
No dependency data recorded yet.