e01.org

Profiler: samplebufferfull event

JS Self-Profiling API

JS Self-Profiling API

The **`samplebufferfull`** event of the Profiler interface is fired when the number of samples the profiler has recorded matches the [`maxBufferSize`](/docs/Web/API/Profiler/Profiler#maxbuffersize) value passed to the profiler's constructor.

After this event fires, the profiler will not record any more samples.

This event is not cancelable and does not bubble.

## Syntax

Use the event name in addEventListener():

```js-nolint
addEventListener("samplebufferfull", (event) => { })
```

Alternatively, assign to the [event handler property](/docs/Web/API/Document_Object_Model/Events#using_onevent_properties) of the interface:

```js-nolint
onsamplebufferfull = (event) => { }
```

## Event type

An Event.

## Examples

```js
const profiler = new Profiler({ sampleInterval: 10, maxBufferSize: 100 });

profiler.addEventListener("samplebufferfull", async () => {
console.log("Sample buffer full!");
const trace = await profiler.stop();
console.log(JSON.stringify(trace));
});
```

## Specifications

## Browser compatibility

source: MDN Web Docs mirror · page

Cite this

"Profiler: samplebufferfull event". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/Profiler/samplebufferfull_event

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·