PerformanceObserver.prototype.observe - Node documentation
method PerformanceObserver.prototype.observe

Usage in Deno

import { PerformanceObserver } from "node:perf_hooks";
PerformanceObserver.prototype.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.entryTypesor options.type:

const {
  performance,
  PerformanceObserver,
} = require('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}`);

Parameters

options: { entryTypes: readonly EntryType[]; buffered?: boolean | undefined; } | { type: EntryType; buffered?: boolean | undefined; }

Return Type

void