# ks.onAppShow
监听小程序切前台事件。
# onAppShow(callback: (options: LaunchOptions) => void): void
# 参数
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
callback | (options: LaunchOptions) => void | 是 | 小程序切前台事件的回调函数 |
LaunchOptions
属性
属性 | 类型 | 说明 |
---|---|---|
path | string | 启动小程序的代码包路径 |
scene | string | 启动小程序的场景值 |
query | Record<string, unknown> | 启动小程序的 query 参数 |
referrerInfo | ReferrerInfo | 进入小程序的来源信息 |
mode | 'default' | 'halfPage' | 启动小程序的模式 |
showFrom | 'schema' | 'other' | 打开小程序的来源方式。'schema' : 用户点击小程序入口 schema ;'other' : 其他 (如:后台进前台)。基础库 1.39.0 开始支持 |
openConfigInfo | OpenConfigInfo | 扩展信息 |
ReferrerInfo
属性
属性 | 类型 | 说明 |
---|---|---|
appId | string | 来源小程序 appId |
extraData | Record<string, unknown> | 来源小程序传过来的数据 |
OpenConfigInfo
属性
属性 | 类型 | 说明 |
---|---|---|
rewardedAd | RewardedAd | 激励视频信息 |
RewardedAd
属性
属性 | 类型 | 说明 |
---|---|---|
minDisplayTimestamp | number | 启动小程序后激励视频最早的展示时间 |