> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# onDestroy

APISummary
页面销毁后调用。

## 语法

### Android

```java
public void onDestroy();
```

:::note

- 回调在主线程中执行。

:::

### Harmony

```typescript
public onDestroy(): void;
```

### Desktop (C++)

```cpp
class YourViewClient : public lynx::pub::LynxViewClient {
 public:
  void OnDestroy() override;
};
```

## 兼容性

**Compatibility Table**

**Query:** `lynx-native-api.lynx-view-client.on-destroy`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-view-client/on-destroy.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| on-destroy | Yes (1.0) | Yes (3.4) | No | Yes (3.7) | Yes (3.7) | No |

**`on-destroy`**

Called after the page is destroyed.

**Specifications:**

