@whitesev/utils 1.4.3 → 1.4.5
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/dist/index.amd.js +7 -5
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +7 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +7 -5
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +7 -5
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +7 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Utils.d.ts +2 -87
- package/dist/src/VueObject.d.ts +107 -0
- package/package.json +1 -1
- package/src/Utils.ts +3 -99
- package/src/VueObject.ts +119 -0
- package/src/ajaxHooker/ajaxHooker.js +6 -4
package/dist/index.esm.js
CHANGED
|
@@ -458,13 +458,14 @@ class UtilsGMCookie {
|
|
|
458
458
|
/// <reference path="./index.d.ts" />
|
|
459
459
|
// @name ajaxHooker
|
|
460
460
|
// @author cxxjackie
|
|
461
|
-
// @version 1.4.
|
|
462
|
-
// @updateLog
|
|
461
|
+
// @version 1.4.3
|
|
462
|
+
// @updateLog 修复特殊情况下有部分请求头丢失的问题。
|
|
463
|
+
// @updateLog xhr事件增加currentTarget劫持。
|
|
463
464
|
// @supportURL https://bbs.tampermonkey.net.cn/thread-3284-1-1.html
|
|
464
465
|
|
|
465
466
|
const AjaxHooker = function () {
|
|
466
467
|
return function() {
|
|
467
|
-
const version = '1.4.
|
|
468
|
+
const version = '1.4.3';
|
|
468
469
|
const hookInst = {
|
|
469
470
|
hookFns: [],
|
|
470
471
|
filters: []
|
|
@@ -719,6 +720,7 @@ const AjaxHooker = function () {
|
|
|
719
720
|
dispatchEvent(e) {
|
|
720
721
|
e.stopImmediatePropagation = stopImmediatePropagation;
|
|
721
722
|
defineProp(e, 'target', () => this.proxyXhr);
|
|
723
|
+
defineProp(e, 'currentTarget', () => this.proxyXhr);
|
|
722
724
|
this.proxyEvents[e.type] && this.proxyEvents[e.type].forEach(fn => {
|
|
723
725
|
this.resThenable.then(() => !e.ajaxHooker_isStopped && fn.call(this.proxyXhr, e));
|
|
724
726
|
});
|
|
@@ -728,7 +730,7 @@ const AjaxHooker = function () {
|
|
|
728
730
|
}
|
|
729
731
|
setRequestHeader(header, value) {
|
|
730
732
|
this.originalXhr.setRequestHeader(header, value);
|
|
731
|
-
if (this.
|
|
733
|
+
if (!this.request) return;
|
|
732
734
|
const headers = this.request.headers;
|
|
733
735
|
headers[header] = header in headers ? `${headers[header]}, ${value}` : value;
|
|
734
736
|
}
|
|
@@ -3057,7 +3059,7 @@ class Utils {
|
|
|
3057
3059
|
UtilsCore.init(option);
|
|
3058
3060
|
}
|
|
3059
3061
|
/** 版本号 */
|
|
3060
|
-
version = "2024.6.
|
|
3062
|
+
version = "2024.6.16";
|
|
3061
3063
|
addStyle(cssText) {
|
|
3062
3064
|
if (typeof cssText !== "string") {
|
|
3063
3065
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|