interface.uts 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9
/**
 * uni.onMemoryWarning/uni.offMemoryWarning回调参数
 */
export type MemoryWarningCallbackResult = {
  /**
   * 内存警告等级(仅安卓平台有效,iOS始终是0)
   */
  level: number
}
10

11 12 13 14 15 16
/**
 * uni.onMemoryWarning/uni.offMemoryWarning回调函数定义
 */
export type MemoryWarningCallback = (res: MemoryWarningCallbackResult) => void

export type OnMemoryWarning = (callback: MemoryWarningCallback) => void
17

18
export type OffMemoryWarning = (callback : MemoryWarningCallback | null) => void
19 20 21 22

export interface Uni {
	/**
	 * 开启监听内存警告
23 24
	 *
	 * @param {MemoryWarningCallback} callback
25 26
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
27
	 *    "app": {
28 29 30 31 32 33
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
34
	 *            "osVer": "12.0",
35
	 *            "uniVer": "3.7.7",
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
36
	 *            "unixVer": "4.11"
37 38 39 40
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
41 42
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
43
	 */
44
	onMemoryWarning(callback: MemoryWarningCallback) : void,
45 46
	/**
	 * 取消监听内存不足告警事件
47 48
	 *
	 * @param {MemoryWarningCallback} callback
49 50
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
51
	 *    "app": {
52 53 54 55 56 57
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
58
	 *            "osVer": "12.0",
59
	 *            "uniVer": "3.7.7",
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
60
	 *            "unixVer": "4.11"
61 62 63 64
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
65 66
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
67
	 */
68 69
	offMemoryWarning(callback : MemoryWarningCallback | null) : void
}