ajax-notify
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Ajax-Notify

This package adds event listeners to XMLHttpRequest and fetch calls. Whenever ajax is called using this two functions, provided callback function will be called.

Api

This package exposes only one function as default.

const { ajaxNotify } = require('ajax-notify');
ajaxNotify(sutStringOrRegExp, (xhr, responseUrl) => {
    // xhr is undefined in case of fetch request
    console.log('request done', xhr, responseUrl);
} )

Here ajaxNotify variable is a function. It has two arguments.

  • urlSubString: string or regular expression which will be included or tested in request url
  • callback: a function which will be executed when request url includes urlSubString.

NOTE:

  • I haven't considered microsoft's ActiveX objects support because, negligible number browsers use it.

Package Sidebar

Install

npm i ajax-notify

Weekly Downloads

7

Version

2.0.2

License

ISC

Unpacked Size

403 kB

Total Files

7

Last publish

Collaborators

  • jatinparate