• callback {Function}
      • list {PerformanceObserverEntryList}
      • observer {PerformanceObserver}

    PerformanceObserver objects provide notifications when new PerformanceEntry instances have been added to the Performance Timeline.

    1. const {
    2. performance,
    3. PerformanceObserver
    4. } = require('perf_hooks');
    5. const obs = new PerformanceObserver((list, observer) => {
    6. console.log(list.getEntries());
    7. observer.disconnect();
    8. });
    9. obs.observe({ entryTypes: ['mark'], buffered: true });
    10. performance.mark('test');

    Because PerformanceObserver instances introduce their own additional performance overhead, instances should not be left subscribed to notifications indefinitely. Users should disconnect observers as soon as they are no longer needed.

    The callback is invoked when a PerformanceObserver is notified about new PerformanceEntry instances. The callback receives a PerformanceObserverEntryList instance and a reference to the PerformanceObserver.