@whitesev/utils 2.6.9 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/dist/index.amd.js +597 -601
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +597 -601
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +597 -601
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +597 -601
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +597 -601
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +597 -601
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Utils.d.ts +1 -1
- package/dist/types/src/ajaxHooker/ajaxHooker.d.ts +1 -1
- package/package.json +11 -9
- package/src/Utils.ts +4 -4
- package/src/ajaxHooker/ajaxHooker.js +549 -553
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 安装
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
- 最新版本:[](https://www.npmjs.com/package/@whitesev/utils)
|
|
4
4
|
|
|
5
5
|
```node
|
|
6
6
|
npm install @whitesev/utils
|
|
@@ -37,8 +37,8 @@ Utils.assign({1:1},{1:2,2:3})
|
|
|
37
37
|
|
|
38
38
|
```javascript
|
|
39
39
|
/* 等待a元素出现,返回Promise对象,在then中或使用await获取结果,统一返回数组格式的元素,如[...a] */
|
|
40
|
-
Utils.waitNode("a").then((element => {
|
|
41
|
-
|
|
40
|
+
Utils.waitNode("a").then((element) => {
|
|
41
|
+
console.log(element);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
/* 同时满足多个选择器的结果,都满足了才会触发回调 */
|
|
@@ -61,24 +61,24 @@ Utils.toJSON("{123:123}");
|
|
|
61
61
|
let httpx = new Utils.Httpx();
|
|
62
62
|
/* 修改配置 */
|
|
63
63
|
httpx.config({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
timeout: 5000,
|
|
65
|
+
onabort: function () {
|
|
66
|
+
console.log("请求取消");
|
|
67
|
+
},
|
|
68
|
+
ontimeout: function () {
|
|
69
|
+
console.log("请求超时");
|
|
70
|
+
},
|
|
71
|
+
onerror: function (response) {
|
|
72
|
+
console.log("httpx-onerror 请求异常");
|
|
73
|
+
console.log(response);
|
|
74
|
+
},
|
|
75
75
|
});
|
|
76
76
|
/* 发送post请求 */
|
|
77
77
|
let postResp = await httpx.post({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
url: url,
|
|
79
|
+
data: JSON.stringify({
|
|
80
|
+
test: 1,
|
|
81
|
+
}),
|
|
82
82
|
});
|
|
83
83
|
```
|
|
84
84
|
|
|
@@ -173,4 +173,4 @@ menu_key:{
|
|
|
173
173
|
GM_Menu.delete("menu_key");
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
等...API
|
|
176
|
+
等...API 请看文档
|