interface.uts 1.9 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7
/**
 * uni.exit成功回调参数
 */
export type ExitSuccess = {
  errMsg: string
}

DCloud-yyl's avatar
DCloud-yyl 已提交
8 9 10
/**
 * 错误码
 */
DCloud-yyl's avatar
DCloud-yyl 已提交
11 12 13 14 15 16 17 18 19
export type ExitErrorCode =
/**
 * 系统不支持
 */
12001 |
/**
 * 未知错误
 */
12002
DCloud-yyl's avatar
DCloud-yyl 已提交
20 21 22 23 24 25 26 27 28

/**
 * uni.exit失败回调参数
 */
export interface IExitError extends IUniError {
	errCode: ExitErrorCode
}
export type ExitFail = IExitError

DCloud-yyl's avatar
DCloud-yyl 已提交
29 30 31 32 33 34 35
/**
 * uni.exit成功回调函数定义
 */
export type ExitSuccessCallback = (res: ExitSuccess) => void
/**
 * uni.exit失败回调函数定义
 */
DCloud-yyl's avatar
DCloud-yyl 已提交
36
export type ExitFailCallback = (res: ExitFail) => void
DCloud-yyl's avatar
DCloud-yyl 已提交
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
/**
 * uni.exit完成回调函数定义
 */
export type ExitCompleteCallback = (res: any) => void

/**
 * uni.exit参数定义
 */
export type ExitOptions = {
  /**
   * 接口调用成功的回调函数
   */
  success?: ExitSuccessCallback | null,
  /**
   * 接口调用失败的回调函数
   */
  fail?: ExitFailCallback | null,
  /**
   * 接口调用结束的回调函数(调用成功、失败都会执行)
   */
  complete?: ExitCompleteCallback | null
}


export interface Uni {

  /**
   * 退出当前应用
   * @uniPlatform {
   *    "app": {
   *        "android": {
DCloud-yyl's avatar
DCloud-yyl 已提交
68
   *            "osVer": "5.0",
DCloud-yyl's avatar
DCloud-yyl 已提交
69
   *            "uniVer": "3.8.15",
DCloud-yyl's avatar
DCloud-yyl 已提交
70
   *            "uniUtsPlugin": "3.9.0",
DCloud-yyl's avatar
DCloud-yyl 已提交
71
   *            "unixVer": "3.9.0",
DCloud-yyl's avatar
DCloud-yyl 已提交
72
   *            "unixUtsPlugin": "3.9.0"
DCloud-yyl's avatar
DCloud-yyl 已提交
73 74 75 76
   *        },
   *        "ios": {
   *            "osVer": "x",
   *            "uniVer": "x",
DCloud-yyl's avatar
DCloud-yyl 已提交
77
   *            "uniUtsPlugin": "x",
DCloud-yyl's avatar
DCloud-yyl 已提交
78
   *            "unixVer": "x",
DCloud-yyl's avatar
DCloud-yyl 已提交
79
   *            "unixUtsPlugin": "x"
DCloud-yyl's avatar
DCloud-yyl 已提交
80 81 82 83 84 85
   *   	  },
   *      "harmony": {
   *        "osVer": "3.0",
   *        "uniVer": "4.23",
   *        "unixVer": "x"
   *      }
DCloud-yyl's avatar
DCloud-yyl 已提交
86 87 88 89 90
   *    },
   *  "web": {
   *    "uniVer": "x",
   *    "unixVer": "x"
   *  }
DCloud-yyl's avatar
DCloud-yyl 已提交
91 92 93 94 95 96 97
   * }
   * @uniVueVersion 2,3  //支持的vue版本
   */
  exit(options?: ExitOptions | null):void;
}

export type Exit = (options?: ExitOptions | null) => void;