@paychex/adapter-xhr
v2.1.9
Published
A data adapter that uses the XMLHttpRequest object in web browsers to convert a Request into a Response.
Readme
@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-xhrImporting
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);