---
name: "onAppHide"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.10.0" }
title: "ty.onAppHide - Listen for the event in which a miniapp switches to the background, triggered at the same time as App.onHide"
---

## onAppHide

> [VERSION] Base Library >= 2.10.0

### Description

Listen for the Mini Program switching to background event. Its callback timing is consistent with App.onHide.

### Parameters

`(callback: Function)`

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

### Return Value

None


### Examples

#### Listen for the mini program entering the background

```js
Page({
  onLoad() {
    ty.onAppHide(() => {
      console.log('Mini Program moved to background');
    });
  },
});
```
