diff --git a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts index ddc8859d2418900a4156a54d0375875a2b522930..8cab5e7004a662f18e46f9a9e6355febf1c9cee8 100644 --- a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts +++ b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts @@ -1,12 +1,11 @@ import { UTSAndroid } from "io.dcloud.uts" -import { OffMemoryWarning, OnMemoryWarning, OnMemoryWarningCallback, OnMemoryWarningCallbackResult } from "../interface.uts" -let listeners: OnMemoryWarningCallback[] = [] +let listeners: UTSCallback[] = [] const onAppTrimMemoryListener = (ret: number) => { listeners.forEach(listener => { - let res:OnMemoryWarningCallbackResult = { + let res = { level:ret } listener(res) @@ -15,7 +14,7 @@ const onAppTrimMemoryListener = (ret: number) => { @Suppress("DEPRECATION") -export function onMemoryWarning(callback: OnMemoryWarningCallback) { +export function onMemoryWarning(callback: UTSCallback) { if (listeners.length == 0) { // 仅首次执行底层的实际监听 UTSAndroid.onAppTrimMemory(onAppTrimMemoryListener) @@ -28,7 +27,7 @@ export function onMemoryWarning(callback: OnMemoryWarningCallback) { } @Suppress("DEPRECATION") -export function offMemoryWarning(callback: OnMemoryWarningCallback | null = null) { +export function offMemoryWarning(callback: UTSCallback | null = null) { if(callback == null){ // 清除全部回调