---
name: "offAppShow"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.10.0" }
title: "ty.offAppShow - Remove listener for miniapp foreground switch event"
---

## offAppShow

> [VERSION] Base Library >= 2.10.0

### Description

Stop listening for the Mini Program entering the foreground

### Parameters

`(callback: Function)`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `callback` | `(res: OnAppShowCallbackResult) => void` | Yes | Callback for canceling the Mini Program foreground switch event listener |

### Return Value

None


### Referenced Types

##### `interface` OnAppShowCallbackResult

| Property | Type | Description |
| --- | --- | --- |
| `path` | `string` | Path used to launch the Mini Program |
| `query` | `Record<string, string>` | Query parameters used to launch the Mini Program |
| `scene` | `number` | Launch scene value |
| `referrerInfo` | `ReferrerInfo` | Referrer info |

##### `interface` ReferrerInfo

| Property | Type | Description |
| --- | --- | --- |
| `appId` | `string` | appId of the referring Mini Program or Official Account |
| `extraData` | `Record<string, unknown>` | Data passed from the referring Mini Program |


### Examples

#### Stop listening for the mini program entering the foreground

```js
Page({
  data: {
    handler: null,
  },
  onLoad() {
    this.data.handler = (res) => {
      console.log('Mini Program moved to foreground', res.path);
    };
    ty.onAppShow(this.data.handler);
  },
  onUnload() {
    ty.offAppShow(this.data.handler);
  },
});
```
