1.0.2 • Published 2 years ago

xhrequest-hooks v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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
  }
})
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago