Skip to main content
PerformanceObserver - node__perf_hooks.d.ts - Node documentation
class PerformanceObserver
extends AsyncResource

Usage in Deno

```typescript import { PerformanceObserver } from "node:node__perf_hooks.d.ts"; ```

Constructors

new
PerformanceObserver(callback: PerformanceObserverCallback)

Methods

disconnect(): void
Disconnects the `PerformanceObserver` instance from all notifications.
observe(options: { entryTypes: readonly EntryType[]; buffered?: boolean | undefined; } | { type: EntryType; buffered?: boolean | undefined; }): void
Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`: ```js import { performance, PerformanceObserver, } from 'node:perf_hooks'; const obs = new PerformanceObserver((list, observer) => { // Called once asynchronously. `list` contains three items. }); obs.observe({ type: 'mark' }); for (let n = 0; n < 3; n++) performance.mark(`test${n}`); ```
variable PerformanceObserver
`PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'`

Type

globalThis extends { onmessage: any; PerformanceObserver: infer T; } ? T : _PerformanceObserver

See

  • https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver