interface.uts 3.9 KB
Newer Older
1 2 3
/**
	* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
	*/
4
export type OnUserCaptureScreenCallbackResult = {
5
	/**
6
		* 截屏文件路径(仅Android返回)
7
		*/
8
	path ?: string
9 10
}

11 12 13
/**
	* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
	*/
14
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
15 16

export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
17

18
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
19

20 21 22 23 24 25
/**
	* uni.setUserCaptureScreen成功回调参数
	*/
export type SetUserCaptureScreenSuccess = {
}

26

27
/**
28 29
	* uni.setUserCaptureScreen成功回调函数定义
	*/
30 31 32
export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void

/**
33 34
	* uni.setUserCaptureScreen失败回调函数定义
	*/
35
export type SetUserCaptureScreenFailCallback = (res : UniError) => void
36 37

/**
38 39
	* uni.setUserCaptureScreen完成回调函数定义
	*/
40 41 42 43 44
export type SetUserCaptureScreenCompleteCallback = (res : any) => void

/**
	* uni.setUserCaptureScreen参数
	*/
lizhongyi_'s avatar
lizhongyi_ 已提交
45

46
export type SetUserCaptureScreenOptions = {
47
	/**
48 49
	* true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
	*/
50
	enable : boolean;
51
	/**
52 53
	* 接口调用成功的回调函数
	*/
54
	// success : SetUserCaptureScreenSuccessCallback | null,
55
	success ?: SetUserCaptureScreenSuccessCallback,
56
	/**
57 58
	* 接口调用失败的回调函数
	*/
59
	// fail : SetUserCaptureScreenFailCallback | null,
60
	fail ?: SetUserCaptureScreenFailCallback,
61
	/**
62 63
	* 接口调用结束的回调函数(调用成功、失败都会执行)
	*/
64
	// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
65
	complete ?: SetUserCaptureScreenCompleteCallback
66 67
}

68
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
69

70 71 72 73 74 75 76
export interface Uni {
	/**
	 * 开启截屏监听 
	 * 
	 * @param {UserCaptureScreenCallback} callback 
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
77
	 *    "app": {
78 79 80 81 82 83 84 85 86 87 88 89 90
	 *        "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
91 92
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
93
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
94
	onUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
95 96 97 98 99 100
	/**
	 * 关闭截屏监听 
	 * 
	 * @param {UserCaptureScreenCallback} callback 
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
101
	 *    "app": {
102 103 104 105 106 107 108 109 110 111 112 113 114
	 *        "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
115 116
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
117
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
118
	offUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
119 120 121 122 123 124
	/**
	 * 设置防截屏  
	 * 
	 * @param {SetUserCaptureScreenOptions} options 
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
125
	 *    "app": {
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
	 *        "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版本
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
141
	setUserCaptureScreen(options : SetUserCaptureScreenOptions) : void
142
}