Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Performance
  4. setResourceTimingBufferSize()

Performance: setResourceTimingBufferSize() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨September 2017⁩.

Note: This feature is available inWeb Workers.

ThesetResourceTimingBufferSize() method sets the desired size of the browser's resource timing buffer which stores the"resource" performance entries.

The specification requires the resource timing buffer initially to be 250 or greater.

To clear the browser's performance resource data buffer, use thePerformance.clearResourceTimings() method.

To get notified when the browser's resource timing buffer is full, listen for theresourcetimingbufferfull event.

Syntax

js
setResourceTimingBufferSize(maxSize)

Parameters

maxSize

Anumber representing the maximum number ofPerformanceEntry objects the browser should hold in its performance entry buffer.

Return value

None (undefined).

Examples

Setting a resource timing buffer size

The following call allows 500"resource" performance entries in the browser's performance timeline.

js
performance.setResourceTimingBufferSize(500);

If you set the buffer size to a number lower than the amount of current entries in the buffer, no entries will be removed. Instead, to clear the buffer, callPerformance.clearResourceTimings().

js
performance.getEntriesByType("resource").length; // 20performance.setResourceTimingBufferSize(10);performance.getEntriesByType("resource").length; // 20performance.clearResourceTimings();performance.getEntriesByType("resource").length; // 0

Specifications

Specification
Resource Timing
# dom-performance-setresourcetimingbuffersize

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp