重启当前小游戏
起始支持版本:Android/iOS 10.55.10,鸿蒙 10.55.20
目前该接口仅支持高性能模式,暂不支持普通模式。
属性 |
类型 |
默认值 |
必填 |
说明 |
success |
function |
否 |
接口调用成功的回调函数 |
|
fail |
function |
否 |
接口调用失败的回调函数 |
|
complete |
function |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
参数
Object res
属性 |
类型 |
说明 |
errMsg |
string |
调用结果 |
参数
Object res
属性 |
类型 |
说明 |
error |
number |
错误码 |
errorMessage |
string |
错误信息 |
errMsg |
string |
错误描述 |
// 基础用法
if (my.restartApp) {
my.restartApp({
fail: function(err) {
console.error('重启失败', err.errorMessage);
// 手淘低版本不支持restartApp,建议使用 my.exit() 兜底处理
my.exit();
}
});
} else {
my.exit();
}