diff --git a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts index a28f12af07ade2f6be38f7c00ee4aaeb7fa8cceb..28bf366a9359e188f6f53ea5bba905746b8a192c 100644 --- a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts +++ b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts @@ -1,5 +1,5 @@ import { UTSAndroid } from "io.dcloud.uts" - +import { OnMemoryWarning, OffMemoryWarning } from "../interface.uts" let listeners: UTSCallback[] = [] @@ -14,7 +14,7 @@ const onAppTrimMemoryListener = (ret: number) => { @Suppress("DEPRECATION") -export function onMemoryWarning(callback: UTSCallback) { +export const onMemoryWarning : OnMemoryWarning = function (callback: UTSCallback) { if (listeners.length == 0) { // 仅首次执行底层的实际监听 UTSAndroid.onAppTrimMemory(onAppTrimMemoryListener) @@ -28,7 +28,7 @@ export function onMemoryWarning(callback: UTSCallback) { @Suppress("DEPRECATION") -export function offMemoryWarning(callback: UTSCallback | null) { +export const offMemoryWarning : OffMemoryWarning = function (callback: UTSCallback | null) { if(callback == null){ // 清除全部回调 diff --git a/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts b/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts index e4dc943ebbcd8df81034a7b0ba4929f2a00b29be..60ee47f5749bf69643f221b9d3ac18f7badaa9f1 100644 --- a/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts +++ b/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts @@ -1,6 +1,7 @@ import { NotificationCenter } from 'Foundation'; import { UIApplication } from "UIKit" import { Selector } from "ObjectiveC" +import { OnMemoryWarning, OffMemoryWarning } from "../interface.uts" class MemoryWarningTool { static listeners: UTSCallback[] = [] @@ -45,12 +46,13 @@ class MemoryWarningTool { } } + // 开启监听内存警告 -export function onMemoryWarning(callback: UTSCallback) { +export const onMemoryWarning : OnMemoryWarning = function (callback: UTSCallback) { MemoryWarningTool.listenMemoryWarning(callback) } // 关闭监听内存警告 -export function offMemoryWarning(callback: UTSCallback | null) { +export const offMemoryWarning : OffMemoryWarning = function (callback: UTSCallback | null) { MemoryWarningTool.removeListen(callback) } \ No newline at end of file diff --git a/uni_modules/uni-memorywarning/utssdk/interface.uts b/uni_modules/uni-memorywarning/utssdk/interface.uts new file mode 100644 index 0000000000000000000000000000000000000000..483c23200cb030fa14496eef16fd31141e04959e --- /dev/null +++ b/uni_modules/uni-memorywarning/utssdk/interface.uts @@ -0,0 +1,53 @@ + +export type OnMemoryWarning = (callback: UTSCallback) => void + +export type OffMemoryWarning = (callback : UTSCallback | null) => void + +export interface Uni { + /** + * 开启监听内存警告 + * + * @param {UTSCallback} 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版本 + */ + onMemoryWarning : OnMemoryWarning, + /** + * 取消监听内存不足告警事件 + * + * @param {UTSCallback} 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版本 + */ + offMemoryWarning : OffMemoryWarning +} \ No newline at end of file diff --git a/uni_modules/uni-usercapturescreen/utssdk/interface.uts b/uni_modules/uni-usercapturescreen/utssdk/interface.uts index 235b78209fb8cd67a64953edead91b355eab4ce1..98ce4c1625243027c4907352aefe6144f283578d 100644 --- a/uni_modules/uni-usercapturescreen/utssdk/interface.uts +++ b/uni_modules/uni-usercapturescreen/utssdk/interface.uts @@ -13,26 +13,8 @@ export type OnUserCaptureScreenCallbackResult = { */ export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void -/** - * uni.onUserCaptureScreen函数定义 - * 开启截屏监听 - * - * @param {UserCaptureScreenCallback} callback - * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen - * @platforms APP-IOS = ^9.0,APP-ANDROID = ^4.4 - * @since 3.7.7 - */ export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void -/** - * uni.offUserCaptureScreen函数定义 - * 关闭截屏监听 - * - * @param {UserCaptureScreenCallback} callback - * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen - * @platforms APP-IOS = ^9.0,APP-ANDROID = ^4.4 - * @since 3.7.7 - */ export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void /** @@ -102,21 +84,76 @@ export type SetUserCaptureScreenOptions = { complete ?: SetUserCaptureScreenCompleteCallback } - -/** - * * uni.setUserCaptureScreen函数定义 - - * 设置防截屏 - * - * @param {SetUserCaptureScreenOptions} options - * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen - * @platforms APP-IOS = ^13.0,APP-ANDROID = ^4.4 - * @since 3.7.7 - */ export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void -export interface Uni { - onUserCaptureScreen : OnUserCaptureScreen, - offUserCaptureScreen : OffUserCaptureScreen, +export interface Uni { + /** + * 开启截屏监听 + * + * @param {UserCaptureScreenCallback} callback + * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen + * @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版本 + */ + onUserCaptureScreen : OnUserCaptureScreen, + /** + * 关闭截屏监听 + * + * @param {UserCaptureScreenCallback} callback + * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen + * @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版本 + */ + offUserCaptureScreen : OffUserCaptureScreen, + /** + * 设置防截屏 + * + * @param {SetUserCaptureScreenOptions} options + * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen + * @uniPlatform { + * app: { + * "android": { + * "osVer": "4.4.4", + * "uniVer": "3.7.7", + * "unixVer": "3.9.0" + * }, + * "ios": { + * "osVer": "13.0", + * "uniVer": "3.7.7", + * "unixVer": "3.9.0" + * } + * } + * } + * @uniVersion 3.7.7 + * @uniVueVersion 2,3 //支持的vue版本 + */ setUserCaptureScreen : SetUserCaptureScreen } \ No newline at end of file