xhrequest-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

hello push-masage

一款消息推送的 javascript 库

使用

yarn add xhrhooks

npm install  xhrhooks
import xhrequestHooks from "xhrhooks"
xhrequestHooks.hook({
  //拦截回调
  onreadystatechange:function(xhr,event){
    console.log("onreadystatechange called: %O")
    //返回false表示不阻断,拦截函数执行完后会接着执行真正的xhr.onreadystatechange回调.
    //返回true则表示阻断,拦截函数执行完后将不会执行xhr.onreadystatechange. 
    return false
  },
  onload:function(xhr,event){
    console.log("onload called")
    return false
  },
  //拦截方法
  open:function(args,xhr){
    console.log("open called: method:%s,url:%s,async:%s",args[0],args[1],args[2])
    //拦截方法的返回值含义同拦截回调的返回值
    return false
  }
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    1

Package Sidebar

Install

npm i xhrequest-hooks

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

32.2 kB

Total Files

10

Last publish

Collaborators

  • silencei