interface.uts 4.7 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
D
DCloud_LXH 已提交
66 67
}

68 69
/**
 * 错误码
D
DCloud_LXH 已提交
70
 * - 12001 "setUserCaptureScreen:system not support"
71 72 73 74 75 76 77 78 79
 * - 12010 "setUserCaptureScreen:system internal error"
 */
export type SetUserCaptureScreenErrorCode = 12001 | 12010;
/**
 * SetUserCaptureScreen 的错误回调参数
 */
export interface SetUserCaptureScreenFail extends IUniError {
  errCode : SetUserCaptureScreenErrorCode
};
80

81
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
82

D
DCloud_LXH 已提交
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
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": "12.0",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "4.11"
	 *   	  },
     *    "harmony": {
     *      "osVer": "x",
     *      "uniVer": "x",
     *      "unixVer": "x"
     *    }
	 *    }
	 * }
	 * @uniVersion 3.7.7
109
	 * @uniVueVersion 2,3  //支持的vue版本
D
DCloud_LXH 已提交
110
	 * @autotest { expectCallback: true }
111
	 */
D
DCloud_LXH 已提交
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
	onUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
	/**
	 * 关闭截屏监听
	 *
	 * @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": "12.0",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "4.11"
	 *   	  },
     *    "harmony": {
     *      "osVer": "x",
     *      "uniVer": "x",
     *      "unixVer": "x"
     *    }
	 *    }
	 * }
	 * @uniVersion 3.7.7
138
	 * @uniVueVersion 2,3  //支持的vue版本
D
DCloud_LXH 已提交
139
	 * @autotest { expectCallback: true }
140
	 */
D
DCloud_LXH 已提交
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
	offUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
	/**
	 * 设置防截屏
	 *
	 * @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": "4.11"
	 *   	  },
     *    "harmony": {
     *      "osVer": "x",
     *      "uniVer": "x",
     *      "unixVer": "x"
     *    }
	 *    }
	 * }
	 * @uniVersion 3.7.7
	 * @uniVueVersion 2,3  //支持的vue版本
168
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
169
	setUserCaptureScreen(options : SetUserCaptureScreenOptions) : void
D
DCloud_LXH 已提交
170
}