@wp-fetch/transport-fetch
v0.1.0
Published
Simple fetch http client transport
Downloads
5
Maintainers
Readme
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.