提交 7c71b6c4 编写于 作者: DCloud-yyl's avatar DCloud-yyl

uts-helloworld示例插件调整共用代码

上级 84c71663
/**
* json参数格式定义
*/
type inputJSON = {
inputText: string,
errCode: number
}
/**
* json入参格式
*/
type JsonParamOptions = {
input: inputJSON;
success: (res: string) => void;
fail: (res: string) => void;
complete: (res: string) => void;
};
/**
* 导出无参的UTS函数
* @param opts
*/
export function callWithoutParam(success: () => void) {
success();
return { name: "doSthWithCallback" };
}
/**
* 导出一个字符串入参的UTS函数
*/
export function callWithStringParam(input: string, success: (res: string) => void) {
success(input);
return { name: "doSthWithCallback" };
}
/**
* 导出一个JSON入参的UTS函数
*/
export function callWithJSONParam(opts: JsonParamOptions) {
opts.input.errCode = 10;
opts.success(opts.input);
return { name: "doSthWithCallback" };
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册