@wp-fetch/transport-fetch

0.1.0 • Public • Published

This is a simple HTTP transport layer following the fetch API. You will need to polyfill or ponyfill fetch ino order to use on older browsers and versions of node e.g. https://github.com/developit/unfetch

Installation

yarn add @wp-fetch/core @wp-fetch/transport-fetch unfetch

OR

npm install @wp-fetch/core @wp-fetch/transport-fetch unfetch

Usage

With unfetch polyfill

import 'unfetch/polyfill'
import Client from '@wp-fetch/core';
import FetchTransport from '@wp-fetch/transport-fetch';

const client = new Client({
  endpoint: 'https://demo.wp-api.org/wp-json/',
  transport: new FetchTransport
});

Without polyfill

import Client from '@wp-fetch/core';
import FetchTransport from '@wp-fetch/transport-fetch';

const client = new Client({
  endpoint: 'https://demo.wp-api.org/wp-json/',
  transport: new FetchTransport
});

yllet

Please refer to the core documentation for details on how to use the yllet client.

Package Sidebar

Install

npm i @wp-fetch/transport-fetch

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

16.3 kB

Total Files

10

Last publish

Collaborators

  • andrewmclagan