Files
zgty-mas-m/uni_modules/zzjc-chainway-p100/utssdk/interface.uts
houjunxiang 386f1e7466 1
2025-10-09 18:19:55 +08:00

55 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* interface.uts
* uts插件接口定义文件按规范定义接口文件可以在HBuilderX中更好的做到语法提示
*/
/**
* myApi 异步函数的参数在type里定义函数需要的参数以及api成功、失败的相关回调函数。
*/
export type MyApiOptions = {
paramA : boolean
success ?: (res : MyApiResult) => void
fail ?: (res : MyApiFail) => void
complete ?: (res : any) => void
}
/**
* 函数返回结果
* 可以是void, 基本数据类型自定义type, 或者其他类型。
* [可选实现]
*/
export type MyApiResult = {
fieldA : number,
fieldB : boolean,
fieldC : string
}
/**
* 错误码
* 根据uni错误码规范要求建议错误码以90开头以下是错误码示例
* - 9010001 错误信息1
* - 9010002 错误信息2
*/
export type MyApiErrorCode = 9010001 | 9010002;
/**
* myApi 的错误回调参数
*/
export interface MyApiFail extends IUniError {
errCode : MyApiErrorCode
};
/* 异步函数定义 */
export type MyApi = (options : MyApiOptions) => void
/* 同步函数定义 */
export type MyApiSync = (paramA : boolean) => MyApiResult
/* 扫码接收回调 */
export type OnScanReceiverCallback = (data: string) => void;
/* 扫码注册 */
export type ScanRegister = (callback : OnScanReceiverCallback) => void
/* 扫码卸载 */
export type ScanUnRegister = () => void