This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Web Workers, except for Service Workers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The takeRecords() method of the PressureObserver interface returns the current list of pressure records stored in the pressure observer, emptying it out.
It is useful when you want to a stop observing a source but would like to be sure to get any records that have not yet been passed into the observer callback.
takeRecords()
None.
An Array of PressureRecord objects.
The following example stores the current list of pressure records into records and empties the pressure observer.
const observer = new PressureObserver(callback);
observer.observe("cpu");
const records = observer.takeRecords();
observer.disconnect(); // shut down observer now that we've taken records
if (records.length > 0) {
console.log(records[0].state);
console.log(records[0].time);
}
| Specification |
|---|
| Compute Pressure Level 1> # the-takerecords-method> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
takeRecords |
125 | 125 | No | 111 | No | No | No | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PressureObserver/takeRecords