fetch-ponyfill
TypeScript icon, indicating that this package has built-in type declarations

7.1.0 • Public • Published

Fetch Ponyfill

WHATWG fetch ponyfill

This module wraps the github/fetch polyfill in a CommonJS module for browserification, and avoids appending anything to the window, instead returning a setup function when fetch-ponyfill is required. Inspired by object-assign.

When used in Node, delegates to node-fetch instead.

Usage

Browserify

const {fetch, Request, Response, Headers} = require('fetch-ponyfill')(options);

Webpack

import fetchPonyfill from 'fetch-ponyfill';
const {fetch, Request, Response, Headers} = fetchPonyfill(options);

Options

Where options is an object with the following optional properties:

option description
Promise An A+ Promise implementation. Defaults to window.Promise in the browser, and global.Promise in Node.
XMLHttpRequest The XMLHttpRequest constructor. This is useful to feed in when working with Firefox OS. Defaults to window.XMLHttpRequest. Has no effect in Node.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 7.1.0
    102,158
    • latest

Version History

Package Sidebar

Install

npm i fetch-ponyfill

Weekly Downloads

192,948

Version

7.1.0

License

MIT

Unpacked Size

29.7 kB

Total Files

7

Last publish

Collaborators

  • qubyte