1.1.0 • Published 6 years ago

request-catcher v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 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

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago