1.1.0 • Published 5 years ago

request-catcher v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

request catcher

npm NPM

This is the ajax request catcher, and confirm some info or do some thing.

Install

npm i -S request-catcher

Simple to use

import rc from 'request-catcher'

rc({
  timeout: 1000,
  onRequestWorking ({ xhr, url, status }) {
    if (status === 'pending') {

    } else if (status === 'loading') {

    } else if (status === 'loaded') {

    }
  },
  onRequestTimeout ({ xhr, url }) {
    // do something
  },
})

configure

  • timeout: default is 1000ms.
  • pendingTimeout: default is timeout, set it the timeout will be invalid.
  • loadingTimeout: default is timeout, set it the timeout will be invalid.
  • urlWhiteLists: url in urlWhiteLists won't be catched.
  • hook: onRequestWorking({ xhr, url, status }) -> if time greater than timeout callback will be do something on pending/loading/loaded.
  • hook: onRequestTimeout({ xhr, url }) -> callback do some thing on timeout.
1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago