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 0000000000000000000000000000000000000000..fbad2381541932af0d66eb7abc0bfb22bbdb1d36 --- /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 +}