Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wx.exitMiniProgram() #10046

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/shared/src/native-apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const needPromiseApis = new Set<string>([
'connectSocket',
'createBLEConnection',
'downloadFile',
'exitMiniProgram',
'getAvailableAudioSources',
'getBLEDeviceCharacteristics',
'getBLEDeviceServices',
Expand Down
24 changes: 24 additions & 0 deletions packages/taro/types/api/open-api/navigate.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
declare namespace Taro {
namespace exitMiniProgram {
interface Option {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: (res: General.CallbackResult) => void
/** 接口调用失败的回调函数 */
fail?: (res: General.CallbackResult) => void
/** 接口调用成功的回调函数 */
success?: (res: General.CallbackResult) => void
}
}

/**
* 退出当前小程序。必须有点击行为才能调用成功。
* 基础库 2.17.3 开始支持
* @supported weapp
* @example
* ```tsx
* Taro.exitMiniProgram()
* ···
*
* @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html
*/
function exitMiniProgram(option: exitMiniProgram.Option): Promise<General.CallbackResult>

namespace navigateToMiniProgram {
interface Option {
/** 要打开的小程序 appId */
Expand Down