2.1.9 • Published 3 years ago

@paychex/adapter-xhr v2.1.9

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

@paychex/adapter-xhr

A data adapter that uses the XMLHttpRequest object to convert a Request into a Response. Can be passed to the @paychex/core createDataLayer factory method to enable data operations on NodeJS.

Installation

npm install @paychex/adapter-xhr

Importing

esm

import { xhr } from '@paychex/adapter-xhr';

cjs

const { xhr } = require('@paychex/adapter-xhr');

amd

define(['@paychex/adapter-xhr'], function({ xhr }) { ... });
require(['@paychex/adapter-xhr'], function({ xhr }) { ... });

iife

const { xhr } = window['@paychex/adapter-xhr'];

Usage

import { data } from '@paychex/core';
import { xhr } from '@paychex/adapter-xhr';

const proxy = data.createProxy();
const { createRequest, fetch, setAdapter } = data.createDataLayer(proxy, xhr);