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

# PerformanceObserver: disconnect() method

APISummary
Stop receiving performance events.

## Syntax

```ts
disconnect();
```

### Parameters

None

### Return Value

None (`undefined`)

## Examples

The following example disconnects the `PerformanceObserver` to disable receiving any more performance events.

**This is an example below: performance-api**

**Entry:** `src/performance-observer-disconnect`
**Bundle:** `dist/performance-observer-disconnect.lynx.bundle`

```tsx {17-18}
import * as React from "@lynx-js/react";
import { root, useMemo, useState } from "@lynx-js/react";
import type { PerformanceEntry } from "@lynx-js/types";
import "../common/common.css";
import "./index.css";

export default function InitLynxviewEntryExample(this: any) {
  const [hasReceivedEntries, setHasReceivedEntries] = useState<boolean>(false);

  function observePerformanceEntry() {
    "background-only";
    // 1. Create a performance observer.
    const observer = lynx.performance.createObserver((entry: PerformanceEntry) => {
      // 3. process performance entries
      setHasReceivedEntries(true);
      console.log(JSON.stringify(entry));
      // 4. stop receive more performance entries if needed
      observer.disconnect();
    });
    // 2. register to listen to the "metric.fcp" and "pipeline" event.
    observer.observe(["pipeline"]);
  }

  useMemo(() => {
    observePerformanceEntry();
  }, []);

  return (
    <view className="container">
      <text className="title">Hello PerformanceObserver::disconnect()</text>
      <view className="card">
        <text className="section-title">Is PerformanceObserver running?</text>
        <view className="entries-container">
          {hasReceivedEntries
            ? <text className="entry">Disconnect</text>
            : <text className="entry-item">Observing</text>}
        </view>
      </view>
    </view>
  );
}

root.render(<InitLynxviewEntryExample />);

if (import.meta.webpackHot) {
  import.meta.webpackHot.accept();
}

```

v0.8.0



## Compatibility

**Compatibility Table**

**Query:** `lynx-api.performance-api.performance-observer.disconnect`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/performance-api/performance-observer/disconnect.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| disconnect | Yes (3.1) | Yes (3.4) | Yes (3.1) | Yes (3.7) | Yes (3.7) | No |

