diff --git a/src/main/ets/utils/AlgorithmHelper.ets b/src/main/ets/utils/AlgorithmHelper.ets index 52579a9..d60bd61 100644 --- a/src/main/ets/utils/AlgorithmHelper.ets +++ b/src/main/ets/utils/AlgorithmHelper.ets @@ -2,6 +2,8 @@ * 计算相关工具类 */ export class AlgorithmHelper { + private constructor() { + } /** * 计算两点间距离 * @param x1 diff --git a/src/main/ets/utils/AppStorageHelper.ets b/src/main/ets/utils/AppStorageHelper.ets index e5d9a9c..846cb67 100644 --- a/src/main/ets/utils/AppStorageHelper.ets +++ b/src/main/ets/utils/AppStorageHelper.ets @@ -2,6 +2,8 @@ * 永久化存储,存储在本地文件 */ export class AppStorageHelper { + private constructor() { + } /** * 缓存 * @param key diff --git a/src/main/ets/utils/LogHelper.ets b/src/main/ets/utils/LogHelper.ets index 3ec442d..b80088c 100644 --- a/src/main/ets/utils/LogHelper.ets +++ b/src/main/ets/utils/LogHelper.ets @@ -5,6 +5,8 @@ const LOGGER_DOMAIN: number = 0x0000 const LOGGER_TAG: string = '=====》' export class LogHelper { + private constructor() { + } private static domain: number = LOGGER_DOMAIN private static tag: string = LOGGER_TAG //日志Tag private static format: string = '%{public}s' @@ -130,5 +132,3 @@ export class LogHelper { } } } - -// export default new LogHelper() //单例(在ES6模块中,当你使用 import 导入一个模块时,实际上是在导入该模块的值的一个引用。这意味着在另一个模块中修改该值会影响原始模块中的值。) \ No newline at end of file diff --git a/src/main/ets/utils/PreferencesHelper.ets b/src/main/ets/utils/PreferencesHelper.ets index 38d51ca..7564ba6 100644 --- a/src/main/ets/utils/PreferencesHelper.ets +++ b/src/main/ets/utils/PreferencesHelper.ets @@ -1,6 +1,9 @@ import preferences from '@ohos.data.preferences'; export class PreferencesHelper { + private constructor() { + } + public static async put(key: string, value: preferences.ValueType | undefined | null) { const pref = await preferences.getPreferences(getContext(), 'PreferencesHelper') @@ -24,6 +27,7 @@ export class PreferencesHelper { }) } + public static async delete(key: string): Promise { return new Promise(async (resolve, reject) => { diff --git a/src/main/ets/utils/SZYXLocalStorageHelper.ts b/src/main/ets/utils/SZYXLocalStorageHelper.ts index 88894d5..835813f 100644 --- a/src/main/ets/utils/SZYXLocalStorageHelper.ts +++ b/src/main/ets/utils/SZYXLocalStorageHelper.ts @@ -1,3 +1,5 @@ export class SZYXLocalStorageHelper{ + private constructor() { + } public static storage: LocalStorage = new LocalStorage(); } \ No newline at end of file diff --git a/src/main/ets/utils/SZYXLocalStorageKeys.ts b/src/main/ets/utils/SZYXLocalStorageKeys.ts index 4145f86..bb23f16 100644 --- a/src/main/ets/utils/SZYXLocalStorageKeys.ts +++ b/src/main/ets/utils/SZYXLocalStorageKeys.ts @@ -1,5 +1,7 @@ export class SZYXLocalStorageKeys{ + private constructor() { + } public static HttpHandlerList: string = 'httpHandlerList'; public static HttpHandlerListLength: string = 'HttpHandlerListLength'; public static XWebViewCLose: string = 'SZYX_XWebViewCLose'; diff --git a/src/main/ets/utils/TimeHelper.ts b/src/main/ets/utils/TimeHelper.ts index 73d0683..d5b5e07 100644 --- a/src/main/ets/utils/TimeHelper.ts +++ b/src/main/ets/utils/TimeHelper.ts @@ -14,6 +14,8 @@ */ export class TimeHelper { + private constructor() { + } /** * 获取当前时间戳 * @returns diff --git a/src/main/ets/utils/ToolsHelper.ets b/src/main/ets/utils/ToolsHelper.ets index 93fa3a0..c8213eb 100644 --- a/src/main/ets/utils/ToolsHelper.ets +++ b/src/main/ets/utils/ToolsHelper.ets @@ -100,6 +100,8 @@ interface ThrottleInterface { * 常用方法 */ export class ToolsHelper { + private constructor() { + } /** * 弹出Toast * @param msg diff --git a/src/main/ets/utils/ToolsHelperForTS.ts b/src/main/ets/utils/ToolsHelperForTS.ts index 2695886..b6f1ba1 100644 --- a/src/main/ets/utils/ToolsHelperForTS.ts +++ b/src/main/ets/utils/ToolsHelperForTS.ts @@ -4,6 +4,8 @@ import { HashMap } from '@kit.ArkTS'; * 常用方法,部分方法,在ets里面不能用 */ export class ToolsHelperForTS { + private constructor() { + } // Map转为Record static mapToRecord(myMap: HashMap): Record { return Object.fromEntries(myMap.entries()) as Record; diff --git a/src/main/ets/utils/ValidatorHelper.ets b/src/main/ets/utils/ValidatorHelper.ets index d1e6f33..343ec64 100644 --- a/src/main/ets/utils/ValidatorHelper.ets +++ b/src/main/ets/utils/ValidatorHelper.ets @@ -2,6 +2,8 @@ * 常用正则验证 */ export class ValidatorHelper { + private constructor() { + } /** * 是否为手机号 * @param phone diff --git a/src/main/ets/utils/WindowHelper.ets b/src/main/ets/utils/WindowHelper.ets index a87a679..d77b228 100644 --- a/src/main/ets/utils/WindowHelper.ets +++ b/src/main/ets/utils/WindowHelper.ets @@ -3,6 +3,8 @@ import { common } from '@kit.AbilityKit'; export class WindowHelper { + private constructor() { + } /** * 缓存窗体,关闭时需要 * 同时只能出现一个窗口,所以只做一个缓存就可以 diff --git a/src/main/ets/utils/XWebHelper.ets b/src/main/ets/utils/XWebHelper.ets index 7b4f350..fef919b 100644 --- a/src/main/ets/utils/XWebHelper.ets +++ b/src/main/ets/utils/XWebHelper.ets @@ -14,6 +14,8 @@ export interface XWebParams { } export class XWebHelper { + private constructor() { + } /** * 打开web页面,加载h5 * @param params