@whitesev/utils 1.0.9 → 1.1.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 +20 -17
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +20 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +20 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +20 -17
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +20 -17
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +20 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Event.d.ts +156 -0
- package/dist/src/Httpx.d.ts +1 -1
- package/dist/src/Log.d.ts +4 -3
- package/dist/src/{index.d.ts → Utils.d.ts} +12 -166
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/Dictionary.ts +1 -1
- package/src/Event.ts +189 -0
- package/src/GBKEncoder.ts +1 -1
- package/src/Httpx.ts +1 -1
- package/src/LockFunction.ts +1 -1
- package/src/Log.ts +28 -25
- package/src/Progress.ts +1 -1
- package/src/{tryCatch.ts → TryCatch.ts} +1 -1
- package/src/{index.ts → Utils.ts} +16 -205
- package/src/UtilsGMCookie.ts +1 -1
- package/src/UtilsGMMenu.ts +1 -1
- package/src/indexedDB.ts +2 -4
- /package/dist/src/{tryCatch.d.ts → TryCatch.d.ts} +0 -0
package/dist/index.system.js
CHANGED
|
@@ -2521,11 +2521,15 @@ System.register('Utils', [], (function (exports) {
|
|
|
2521
2521
|
}
|
|
2522
2522
|
|
|
2523
2523
|
class Log {
|
|
2524
|
-
/**
|
|
2524
|
+
/** 是否禁用输出的flag */
|
|
2525
2525
|
#disable = false;
|
|
2526
|
-
|
|
2526
|
+
/** 前面的TAG标志 */
|
|
2527
|
+
tag = "Utils.Log";
|
|
2528
|
+
/* 使用的console函数 */
|
|
2527
2529
|
#console = null;
|
|
2530
|
+
/* 当前输出的数量 */
|
|
2528
2531
|
#logCount = 0;
|
|
2532
|
+
/* 配置 */
|
|
2529
2533
|
#details = {
|
|
2530
2534
|
tag: true,
|
|
2531
2535
|
successColor: "#0000FF",
|
|
@@ -2536,10 +2540,6 @@ System.register('Utils', [], (function (exports) {
|
|
|
2536
2540
|
autoClearConsole: false,
|
|
2537
2541
|
logMaxCount: 999,
|
|
2538
2542
|
};
|
|
2539
|
-
/**
|
|
2540
|
-
* 待恢复的函数或对象
|
|
2541
|
-
*/
|
|
2542
|
-
#recoveryList = [];
|
|
2543
2543
|
#msgColorDetails = [
|
|
2544
2544
|
"font-weight: bold; color: cornflowerblue",
|
|
2545
2545
|
"font-weight: bold; color: cornflowerblue",
|
|
@@ -2547,15 +2547,17 @@ System.register('Utils', [], (function (exports) {
|
|
|
2547
2547
|
"font-weight: bold; color: cornflowerblue",
|
|
2548
2548
|
];
|
|
2549
2549
|
/**
|
|
2550
|
-
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}}
|
|
2550
|
+
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}},或者直接是一个字符串
|
|
2551
2551
|
* @param console 可指定console对象为unsafeWindow下的console或者是油猴window下的console
|
|
2552
2552
|
*/
|
|
2553
|
-
constructor(_GM_info_ = {
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
|
|
2553
|
+
constructor(_GM_info_, console = globalThis.console) {
|
|
2554
|
+
if (typeof _GM_info_ === "string") {
|
|
2555
|
+
this.tag = _GM_info_;
|
|
2556
|
+
}
|
|
2557
|
+
else if (typeof _GM_info_ === "object" &&
|
|
2558
|
+
typeof _GM_info_?.script?.name === "string") {
|
|
2559
|
+
this.tag = _GM_info_.script.name;
|
|
2560
|
+
}
|
|
2559
2561
|
this.#console = console;
|
|
2560
2562
|
}
|
|
2561
2563
|
/**
|
|
@@ -2577,10 +2579,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
2577
2579
|
if (stackFunctionNamePositionMatch == null) {
|
|
2578
2580
|
continue;
|
|
2579
2581
|
}
|
|
2582
|
+
/* 获取最后一个,因为第一个是包含了at */
|
|
2580
2583
|
let stackFunctionName = stackFunctionNameMatch[stackFunctionNameMatch.length - 1];
|
|
2581
2584
|
let stackFunctionNamePosition = stackFunctionNamePositionMatch[stackFunctionNamePositionMatch.length - 1];
|
|
2582
2585
|
if (stackFunctionName === "" ||
|
|
2583
|
-
stackFunctionName.match(
|
|
2586
|
+
stackFunctionName.match(/^(Utils\.|)Log(\.|)|.<anonymous>$|^Function.each|^NodeList.forEach|^k.fn.init.each/g)) {
|
|
2584
2587
|
continue;
|
|
2585
2588
|
}
|
|
2586
2589
|
else {
|
|
@@ -2621,7 +2624,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
2621
2624
|
* @param otherStyle 其它CSS
|
|
2622
2625
|
*/
|
|
2623
2626
|
printContent(msg, color, otherStyle) {
|
|
2624
|
-
this.checkClearConsole
|
|
2627
|
+
this.checkClearConsole();
|
|
2625
2628
|
otherStyle = otherStyle || "";
|
|
2626
2629
|
let stackSplit = new Error().stack.split("\n");
|
|
2627
2630
|
stackSplit.splice(0, 2);
|
|
@@ -2710,7 +2713,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
2710
2713
|
table(msg, color = this.#details.infoColor, otherStyle = "") {
|
|
2711
2714
|
if (this.#disable)
|
|
2712
2715
|
return;
|
|
2713
|
-
this.checkClearConsole
|
|
2716
|
+
this.checkClearConsole();
|
|
2714
2717
|
let stack = new Error().stack.split("\n");
|
|
2715
2718
|
stack.splice(0, 1);
|
|
2716
2719
|
let errorStackParse = this.parseErrorStack(stack);
|
|
@@ -3079,7 +3082,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3079
3082
|
/// <reference path="./ajaxHooker/index.d.ts" />
|
|
3080
3083
|
class Utils {
|
|
3081
3084
|
/** 版本号 */
|
|
3082
|
-
version = "2024.5.
|
|
3085
|
+
version = "2024.5.28";
|
|
3083
3086
|
addStyle(cssText) {
|
|
3084
3087
|
if (typeof cssText !== "string") {
|
|
3085
3088
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|