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

## offAppHide

> [VERSION] Base Library >= 2.10.0

### Description

Stop listening for the Mini Program entering the background

### Parameters

`(callback: Function)`

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

### Return Value

None


### Examples

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

```js
Page({
  data: {
    handler: null,
  },
  onLoad() {
    this.data.handler = () => {
      console.log('Mini Program moved to background');
    };
    ty.onAppHide(this.data.handler);
  },
  onUnload() {
    ty.offAppHide(this.data.handler);
  },
});
```
