From dcfa32bb9a0ab3979a4bd081fb628751b04dc47b Mon Sep 17 00:00:00 2001 From: lizhongyi Date: Thu, 9 Nov 2023 20:40:03 +0800 Subject: [PATCH] =?UTF-8?q?uni-memorywarning=20=E6=B7=BB=E5=8A=A0index.d.t?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-memorywarning/utssdk/index.d.ts | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 uni_modules/uni-memorywarning/utssdk/index.d.ts diff --git a/uni_modules/uni-memorywarning/utssdk/index.d.ts b/uni_modules/uni-memorywarning/utssdk/index.d.ts new file mode 100644 index 0000000..fbad238 --- /dev/null +++ b/uni_modules/uni-memorywarning/utssdk/index.d.ts @@ -0,0 +1,71 @@ +declare namespace UniNamespace { + +interface MemoryWarningCallbackResult { + /** + * 内存警告等级(仅安卓平台有效,iOS始终是0) + */ + level: number +} + +/** + * uni.onMemoryWarning/uni.offMemoryWarning回调函数定义 + */ +type MemoryWarningCallback = (res: MemoryWarningCallbackResult) => void + +type OnMemoryWarning = (callback: MemoryWarningCallback) => void + +type OffMemoryWarning = (callback : MemoryWarningCallback | null) => void + +} + + +declare interface Uni { + /** + * 开启监听内存警告 + * + * @param {MemoryWarningCallback} callback + * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning + * @uniPlatform { + * "app": { + * "android": { + * "osVer": "4.4.4", + * "uniVer": "3.7.7", + * "unixVer": "3.9.0" + * }, + * "ios": { + * "osVer": "9.0", + * "uniVer": "3.7.7", + * "unixVer": "3.9.0" + * } + * } + * } + * @uniVersion 3.7.7 + * @uniVueVersion 2,3 //支持的vue版本 + * @autotest { expectCallback: true } + */ + onMemoryWarning(callback: UniNamespace.MemoryWarningCallback) : void, + /** + * 取消监听内存不足告警事件 + * + * @param {MemoryWarningCallback} callback + * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning + * @uniPlatform { + * "app": { + * "android": { + * "osVer": "4.4.4", + * "uniVer": "3.7.7", + * "unixVer": "3.9.0" + * }, + * "ios": { + * "osVer": "9.0", + * "uniVer": "3.7.7", + * "unixVer": "3.9.0" + * } + * } + * } + * @uniVersion 3.7.7 + * @uniVueVersion 2,3 //支持的vue版本 + * @autotest { expectCallback: true } + */ + offMemoryWarning(callback : UniNamespace.MemoryWarningCallback | null) : void +} -- GitLab