@whitesev/utils 1.6.1 → 1.7.0
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 +32 -24
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +32 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +32 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +32 -24
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +32 -24
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +32 -24
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Dictionary.d.ts +1 -1
- package/package.json +10 -2
- package/index.ts +0 -3
- package/rollup.config.js +0 -57
- package/src/AjaxHookerType.ts +0 -155
- package/src/ColorConversion.ts +0 -130
- package/src/Dictionary.ts +0 -152
- package/src/Event.ts +0 -189
- package/src/GBKEncoder.ts +0 -120
- package/src/Hooks.ts +0 -87
- package/src/Httpx.ts +0 -2402
- package/src/LockFunction.ts +0 -67
- package/src/Log.ts +0 -284
- package/src/Progress.ts +0 -143
- package/src/TryCatch.ts +0 -107
- package/src/Utils.ts +0 -4917
- package/src/UtilsCommon.ts +0 -20
- package/src/UtilsCore.ts +0 -47
- package/src/UtilsGMCookie.ts +0 -261
- package/src/UtilsGMMenu.ts +0 -530
- package/src/VueObject.ts +0 -128
- package/src/ajaxHooker/ajaxHooker.js +0 -566
- package/src/indexedDB.ts +0 -419
- package/tsconfig.json +0 -31
package/dist/index.umd.js
CHANGED
|
@@ -1569,11 +1569,13 @@
|
|
|
1569
1569
|
* @private
|
|
1570
1570
|
*/
|
|
1571
1571
|
beforeRequestCallBack(details) {
|
|
1572
|
-
if (
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1572
|
+
if (details.allowInterceptConfig) {
|
|
1573
|
+
// 首先配置得存在,不然默认允许拦截
|
|
1574
|
+
if (typeof details.allowInterceptConfig.beforeRequest === "boolean" &&
|
|
1575
|
+
!details.allowInterceptConfig.beforeRequest) {
|
|
1576
|
+
// 设置了禁止拦截
|
|
1577
|
+
return details;
|
|
1578
|
+
}
|
|
1577
1579
|
}
|
|
1578
1580
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1579
1581
|
let item = this.$config.configList[index];
|
|
@@ -1636,11 +1638,14 @@
|
|
|
1636
1638
|
* @param details 请求的配置
|
|
1637
1639
|
*/
|
|
1638
1640
|
successResponseCallBack(response, details) {
|
|
1639
|
-
if (
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1641
|
+
if (details.allowInterceptConfig) {
|
|
1642
|
+
// 首先配置得存在,不然默认允许拦截
|
|
1643
|
+
if (typeof details.allowInterceptConfig.afterResponseSuccess ===
|
|
1644
|
+
"boolean" &&
|
|
1645
|
+
!details.allowInterceptConfig.afterResponseSuccess) {
|
|
1646
|
+
// 设置了禁止拦截
|
|
1647
|
+
return details;
|
|
1648
|
+
}
|
|
1644
1649
|
}
|
|
1645
1650
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1646
1651
|
let item = this.$config.configList[index];
|
|
@@ -1657,11 +1662,14 @@
|
|
|
1657
1662
|
* @param data 配置
|
|
1658
1663
|
*/
|
|
1659
1664
|
errorResponseCallBack(data) {
|
|
1660
|
-
if (
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
+
if (data.details.allowInterceptConfig) {
|
|
1666
|
+
// 首先配置得存在,不然默认允许拦截
|
|
1667
|
+
if (typeof data.details.allowInterceptConfig.afterResponseError ===
|
|
1668
|
+
"boolean" &&
|
|
1669
|
+
!data.details.allowInterceptConfig.afterResponseError) {
|
|
1670
|
+
// 设置了禁止拦截
|
|
1671
|
+
return data;
|
|
1672
|
+
}
|
|
1665
1673
|
}
|
|
1666
1674
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1667
1675
|
let item = this.$config.configList[index];
|
|
@@ -3282,14 +3290,14 @@
|
|
|
3282
3290
|
};
|
|
3283
3291
|
|
|
3284
3292
|
class UtilsDictionary {
|
|
3285
|
-
items = {};
|
|
3293
|
+
#items = {};
|
|
3286
3294
|
constructor() { }
|
|
3287
3295
|
/**
|
|
3288
3296
|
* 检查是否有某一个键
|
|
3289
3297
|
* @param key 键
|
|
3290
3298
|
*/
|
|
3291
3299
|
has(key) {
|
|
3292
|
-
return this
|
|
3300
|
+
return this.#items.hasOwnProperty(key);
|
|
3293
3301
|
}
|
|
3294
3302
|
/**
|
|
3295
3303
|
* 检查已有的键中是否以xx开头
|
|
@@ -3313,7 +3321,7 @@
|
|
|
3313
3321
|
let result = null;
|
|
3314
3322
|
for (const keyName of allKeys) {
|
|
3315
3323
|
if (keyName.startsWith(key)) {
|
|
3316
|
-
result = this
|
|
3324
|
+
result = this.#items[keyName];
|
|
3317
3325
|
break;
|
|
3318
3326
|
}
|
|
3319
3327
|
}
|
|
@@ -3328,7 +3336,7 @@
|
|
|
3328
3336
|
if (key === void 0) {
|
|
3329
3337
|
throw new Error("Utils.Dictionary().set 参数 key 不能为空");
|
|
3330
3338
|
}
|
|
3331
|
-
this
|
|
3339
|
+
this.#items[key] = val;
|
|
3332
3340
|
}
|
|
3333
3341
|
/**
|
|
3334
3342
|
* 删除某一个键
|
|
@@ -3336,7 +3344,7 @@
|
|
|
3336
3344
|
*/
|
|
3337
3345
|
delete(key) {
|
|
3338
3346
|
if (this.has(key)) {
|
|
3339
|
-
Reflect.deleteProperty(this
|
|
3347
|
+
Reflect.deleteProperty(this.#items, key);
|
|
3340
3348
|
return true;
|
|
3341
3349
|
}
|
|
3342
3350
|
return false;
|
|
@@ -3364,8 +3372,8 @@
|
|
|
3364
3372
|
* 清空字典
|
|
3365
3373
|
*/
|
|
3366
3374
|
clear() {
|
|
3367
|
-
this
|
|
3368
|
-
this
|
|
3375
|
+
this.#items = void 0;
|
|
3376
|
+
this.#items = {};
|
|
3369
3377
|
}
|
|
3370
3378
|
/**
|
|
3371
3379
|
* 获取字典的长度
|
|
@@ -3383,14 +3391,14 @@
|
|
|
3383
3391
|
* 返回字典本身
|
|
3384
3392
|
*/
|
|
3385
3393
|
getItems() {
|
|
3386
|
-
return this
|
|
3394
|
+
return this.#items;
|
|
3387
3395
|
}
|
|
3388
3396
|
/**
|
|
3389
3397
|
* 合并另一个字典
|
|
3390
3398
|
* @param data 需要合并的字典
|
|
3391
3399
|
*/
|
|
3392
3400
|
concat(data) {
|
|
3393
|
-
this
|
|
3401
|
+
this.#items = utils.assign(this.#items, data.getItems());
|
|
3394
3402
|
}
|
|
3395
3403
|
forEach(callbackfn) {
|
|
3396
3404
|
for (const key in this.getItems()) {
|