提交 5b734e04 编写于 作者: lizhongyi_'s avatar lizhongyi_

update uni-usercapturescreen uni-momorywarning插件interface

上级 4a31b6b6
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){
// 清除全部回调
......
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
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
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册