Web APIs

PerformanceObserver.observe()

Try the free JavaScript compiler

Registers interest in selected entry types. A single type can request available buffered entries; entryTypes selects a list without buffered.

Formal Syntax & Structure

javascript syntaxjavascript
observer.observe(options)

Parameters & Attributes

NameTypeDescription
optionsPerformanceObserverInitObservation configuration.

Return Value

undefined

Registers observation.

Working Example

Example Snippetjavascript
(async () => {performance.mark("v16-earlier",{startTime:4});let observer;try{const name=await new Promise(resolve=>{observer=new PerformanceObserver(list=>resolve(list.getEntries().find(e=>e.name==="v16-earlier")?.name));observer.observe({type:"mark",buffered:true});});console.log(name);}finally{observer?.disconnect();performance.clearMarks("v16-earlier");}})()
JavaScript Reference