Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@deanacus/ajax

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deanacus/ajax

A simple promise based wrapper for XHR

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Ajax

A simple little wrapper around XMLHttpRequest to promisify getting and sending data.

Build solely as an excuse to get started learning how to create and resolve promises

Install

Use npm npm install --save @deanacus/ajax

Usage

Import the library into your file:

import '@deanacus/ajax'

Then, depending on if you want to get data, or send data, use the appropriate interface.

Get

To request data, call ajax.get()

Paramaters:

OptionValue typeDescription
endpointstringThe URL to which you would like to make the request
headersobjectAn object containing the key/value pairs to set as request headers

Send

To send data, call ajax.send()

Paramaters:

OptionValue typeDescription
endpointstringThe URL to which you would like to send the request
payloadanyThe data you wish to send to the enpoint. This is not processed in any way
headersobjectAn object container the key/value pairs to set as request headers

Keywords

ajax

FAQs

Package last updated on 21 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts