Web APIs
PerformanceObserver.observe()
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
| Name | Type | Description |
|---|---|---|
| options | PerformanceObserverInit | Observation 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");}})()