my-uniapp-tools 1.0.9 → 1.0.11
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/OPTIMIZATION_REPORT.md +278 -278
- package/README.md +477 -477
- package/dist/index.d.ts +1 -1
- package/dist/my-uniapp-tools.cjs.js +53 -39
- package/dist/my-uniapp-tools.cjs.js.map +1 -1
- package/dist/my-uniapp-tools.esm.js +53 -39
- package/dist/my-uniapp-tools.esm.js.map +1 -1
- package/package.json +73 -65
package/dist/index.d.ts
CHANGED
|
@@ -102,6 +102,14 @@ function safeSync(operation, moduleName, errorCode = 'SYNC_ERROR', defaultValue
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
var errorHandler = /*#__PURE__*/Object.freeze({
|
|
106
|
+
__proto__: null,
|
|
107
|
+
ErrorHandler: ErrorHandler,
|
|
108
|
+
UniAppToolsError: UniAppToolsError,
|
|
109
|
+
safeAsync: safeAsync,
|
|
110
|
+
safeSync: safeSync
|
|
111
|
+
});
|
|
112
|
+
|
|
105
113
|
/**
|
|
106
114
|
* 性能监控工具
|
|
107
115
|
*/
|
|
@@ -219,6 +227,12 @@ function measurePerformance(moduleName) {
|
|
|
219
227
|
};
|
|
220
228
|
}
|
|
221
229
|
|
|
230
|
+
var performance$1 = /*#__PURE__*/Object.freeze({
|
|
231
|
+
__proto__: null,
|
|
232
|
+
PerformanceMonitor: PerformanceMonitor,
|
|
233
|
+
measurePerformance: measurePerformance
|
|
234
|
+
});
|
|
235
|
+
|
|
222
236
|
/**
|
|
223
237
|
* UI交互相关工具函数
|
|
224
238
|
*/
|
|
@@ -1639,45 +1653,45 @@ function batchGetStorage(keys) {
|
|
|
1639
1653
|
return result;
|
|
1640
1654
|
}
|
|
1641
1655
|
|
|
1642
|
-
// 核心功能
|
|
1643
|
-
|
|
1644
|
-
// 版本信息
|
|
1645
|
-
const VERSION = '1.0.8';
|
|
1646
|
-
|
|
1647
|
-
// 初始化函数
|
|
1648
|
-
function initUniAppTools(config = {}) {
|
|
1649
|
-
const {
|
|
1650
|
-
enablePerformanceMonitor = false,
|
|
1651
|
-
enableErrorHandler = true,
|
|
1652
|
-
logLevel = 'warn'
|
|
1653
|
-
} = config;
|
|
1654
|
-
|
|
1655
|
-
if (enableErrorHandler) {
|
|
1656
|
-
const { ErrorHandler } =
|
|
1657
|
-
const errorHandler = ErrorHandler.getInstance();
|
|
1658
|
-
|
|
1659
|
-
// 设置全局错误监听
|
|
1660
|
-
if (enablePerformanceMonitor) {
|
|
1661
|
-
errorHandler.onError((error) => {
|
|
1662
|
-
console.log(`[UniAppTools] ${error.module} - ${error.code}: ${error.message}`);
|
|
1663
|
-
});
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
if (enablePerformanceMonitor) {
|
|
1668
|
-
const { PerformanceMonitor } =
|
|
1669
|
-
const monitor = PerformanceMonitor.getInstance();
|
|
1670
|
-
|
|
1671
|
-
// 定期输出性能报告
|
|
1672
|
-
setInterval(() => {
|
|
1673
|
-
const report = monitor.getReport();
|
|
1674
|
-
if (report.slowest.length > 0) {
|
|
1675
|
-
console.log('[UniAppTools] 性能报告:', report);
|
|
1676
|
-
}
|
|
1677
|
-
}, 60000); // 每分钟输出一次
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
console.log(`[UniAppTools] v${VERSION} 初始化完成`);
|
|
1656
|
+
// 核心功能
|
|
1657
|
+
|
|
1658
|
+
// 版本信息
|
|
1659
|
+
const VERSION = '1.0.8';
|
|
1660
|
+
|
|
1661
|
+
// 初始化函数
|
|
1662
|
+
async function initUniAppTools(config = {}) {
|
|
1663
|
+
const {
|
|
1664
|
+
enablePerformanceMonitor = false,
|
|
1665
|
+
enableErrorHandler = true,
|
|
1666
|
+
logLevel = 'warn'
|
|
1667
|
+
} = config;
|
|
1668
|
+
|
|
1669
|
+
if (enableErrorHandler) {
|
|
1670
|
+
const { ErrorHandler } = await Promise.resolve().then(function () { return errorHandler; });
|
|
1671
|
+
const errorHandler$1 = ErrorHandler.getInstance();
|
|
1672
|
+
|
|
1673
|
+
// 设置全局错误监听
|
|
1674
|
+
if (enablePerformanceMonitor) {
|
|
1675
|
+
errorHandler$1.onError((error) => {
|
|
1676
|
+
console.log(`[UniAppTools] ${error.module} - ${error.code}: ${error.message}`);
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
if (enablePerformanceMonitor) {
|
|
1682
|
+
const { PerformanceMonitor } = await Promise.resolve().then(function () { return performance$1; });
|
|
1683
|
+
const monitor = PerformanceMonitor.getInstance();
|
|
1684
|
+
|
|
1685
|
+
// 定期输出性能报告
|
|
1686
|
+
setInterval(() => {
|
|
1687
|
+
const report = monitor.getReport();
|
|
1688
|
+
if (report.slowest.length > 0) {
|
|
1689
|
+
console.log('[UniAppTools] 性能报告:', report);
|
|
1690
|
+
}
|
|
1691
|
+
}, 60000); // 每分钟输出一次
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
console.log(`[UniAppTools] v${VERSION} 初始化完成`);
|
|
1681
1695
|
}
|
|
1682
1696
|
|
|
1683
1697
|
exports.ErrorHandler = ErrorHandler;
|