From c2b12015993b95df7e87cb0cb2ee72b153cffb82 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Thu, 16 Mar 2023 15:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E8=AD=A6=E5=91=8A=E5=85=88?= =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=BC=9A=20utscallback=20=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-memorywarning/utssdk/app-android/index.uts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts index ddc8859..8cab5e7 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){ // 清除全部回调 -- GitLab