interface.uts 3.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 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 109 110 111 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 138 139 140 141 142 143 144 145
export type uni = {
	/**
	  * createNotificationProgress()
	  * @description 
	  * 创建通知栏下载进度消息
	  * @param {CreateNotificationProgressOptions} 
	  * @return {void} 
	  * @uniPlatform {
	  *    "app": {
	  *        "android": {
	  *            "osVer": "4.4",
	  *  		  	 "uniVer": "3.9+",
	  * 			 "unixVer": "3.9+"
	  *        },
	  *        "ios": {
	  *            "osVer": "x",
	  *  		  	 "uniVer": "x",
	  * 			 "unixVer": "x"
	  *        }
	  *    }
	  * }
	  * @example
	   ```typescript
		uni.createNotificationProgress({
			title: "正在下载升级包",
			content: "进度 50%",
			progress: 50,
			onClick:()=>{
				console.log("正在下载");
			}
		}
	   ```
	  */
	createNotificationProgress : (options : CreateNotificationProgressOptions) => void,
	/**
	  * finishNotificationProgress()
	  * @description 
	  * 通知栏显示下载完成,并且传入点击通知栏消息的回调。
	  * @param {FinishNotificationProgressOptions} 
	  * @return {void} 
	  * @uniPlatform {
	  *    "app": {
	  *        "android": {
	  *            "osVer": "4.4",
	  *  		  	 "uniVer": "3.9+",
	  * 			 "unixVer": "3.9+"
	  *        },
	  *        "ios": {
	  *            "osVer": "x",
	  *  		  	 "uniVer": "x",
	  * 			 "unixVer": "x"
	  *        }
	  *    }
	  * }
	  * @example
	   ```typescript
		uni.finishNotificationProgress({
			title: "安装升级包",
			content: "下载完成。",
			onClick: () => {
				uni.installApk({
					filePath: e.tempFilePath,
					complete(res) {
						console.log(res);
					}
				})
			}
		}
	   ```
	   */
	finishNotificationProgress : (options: FinishNotificationProgressOptions) => void,
	/**
	  * cancelNotificationProgress()
	  * @description 
	  * 取消通知消息显示
	  * @param {void} 
	  * @return {void} 
	  * @uniPlatform {
	  *    "app": {
	  *        "android": {
	  *            "osVer": "4.4",
	  *  		  	 "uniVer": "3.9+",
	  * 			 "unixVer": "3.9+"
	  *        },
	  *        "ios": {
	  *            "osVer": "x",
	  *  		  	 "uniVer": "x",
	  * 			 "unixVer": "x"
	  *        }
	  *    }
	  * }
	  * @example
	   ```typescript
		uni.cancelNotificationProgress()
	   ```
	   */
	cancelNotificationProgress : () => void
}

export type CreateNotificationProgressOptions = {
	/**
	 * 通知标题
	 * @defaultValue 应用名称
	 */
	title ?: string | null
	/**
	 * 通知内容
	 */
	content : string,
	/**
	 * 进度
	 */
	progress : number,
	/**
	 * 点击通知消息回调
	 * @defaultValue null
	 */
	onClick? : (() => void) | null
}


export type FinishNotificationProgressOptions = {
	/**
	 * 通知标题
	 * @defaultValue 应用名称
	 */
	title ?: string | null
	/**
	 * 通知内容
	 */
	content : string,
	/**
	 * 点击通知消息回调
	 */
	onClick : () => void
}


export type CreateNotificationProgress = (options : CreateNotificationProgressOptions) => void;


export type CancelNotificationProgress = () => void;


export type FinishNotificationProgress = (options: FinishNotificationProgressOptions) => void