New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

xhr-request-interceptor

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xhr-request-interceptor

Allows you to intercept XHR requests. Useful to detect disconnected users, delaying calls while reconnecting them, things like that.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

xhr-intercept

Install

npm i -S xhr-intercept

API

import XhrIntercept from 'xhr-intercept';

function onRequest(xhr, args) {
  console.debug('request', xhr);

  // Return false to cancel the request
  return false;
}

function onResponse(xhr) {
  console.debug('request', xhr);
}

// Add a callback on request or response
XhrIntercept.addRequestCallback(onRequest);
XhrIntercept.addResponseCallback(onResponse);

// Starting intercepting requests
XhrIntercept.wire();

// Remove a callback on request or response
XhrIntercept.removeRequestCallback(onRequest);
XhrIntercept.removeResponseCallback(onResponse);

// Stopping intercepting requests
XhrIntercept.unwire();

Keywords

xhr

FAQs

Package last updated on 30 Aug 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