index.uts 510 字节
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3
import { ExitOptions, Exit, ExitSuccess} from "../interface.uts"
import { ExitFailImpl} from "../unierror.uts"
import { UTSiOS } from "DCloudUTSFoundation";
DCloud-yyl's avatar
DCloud-yyl 已提交
4 5 6 7 8 9


/**
 * 实现uni.exit
 */
export const exit : Exit = function (options: ExitOptions | null) {
DCloud-yyl's avatar
DCloud-yyl 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22
	
	const result = UTSiOS.exit();
	if(result){
		let ret : ExitSuccess ={
			errMsg: "exit:ok"
		}
		options?.success?.(ret)
		options?.complete?.(ret)
	}else{
		let error = new ExitFailImpl(12003);
		options?.fail?.(error)
		options?.complete?.(error)
	}
DCloud-yyl's avatar
DCloud-yyl 已提交
23
}