@financial-times/o-fetch-jsonp

2.3.0 • Public • Published

o-fetch-jsonp is deprecated. Use the fetch polyfill and Cross-Origin Resource Sharing instead.

o-fetch-jsonp

Client side fetch wrapper that fallbacks to JSONP

Client

Uses fetch, but fallbacks to a fetch-like interface using JSONP under the hood

Install

bower install -S o-fetch-jsonp

Usage

import fetchJsonp from 'o-fetch-jsonp';
const opts = {
    timeout: 1000
};
fetchJsonp('http://other.domain.com/foo', opts)
    .then(data => {
        ...
    });

Note: If using CommonJS modules,

const fetchJsonp = require('o-fetch-jsonp').default;

Where opts can take

  • {number} [timeout=2000]

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @financial-times/o-fetch-jsonp

      Weekly Downloads

      323

      Version

      2.3.0

      License

      none

      Unpacked Size

      3.51 kB

      Total Files

      4

      Last publish

      Collaborators

      • robgodfrey
      • robertboulton
      • seraph2000
      • hamza.samih
      • notlee
      • emmalewis
      • aendra
      • the-ft
      • rowanmanning
      • chee
      • alexwilson