blob: 16e2b23f75bd62a100b65576d565018a306017da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
---
title: PerformanceObserver.takeRecords()
slug: Web/API/PerformanceObserver/takeRecords
tags:
- API
- PerformanceObserver
- takeRecords()
- オブザーバー
- パフォーマンスオブザーバー API
- メソッド
- リファレンス
translation_of: Web/API/PerformanceObserver/takeRecords
---
<div>{{APIRef("Performance Timeline API")}}</div>
<p>{{domxref('PerformanceObserver')}} インターフェイスの <strong><code>takeRecords()</code></strong> メソッドは、パフォーマンスオブザーバーに格納されている{{domxref("PerformanceEntry","パフォーマンスエントリ")}}の現在のリストを空にして返します。</p>
<h2 id="構文">構文</h2>
<pre class="syntaxbox">var PerformanceEntry[] = <em>performanceObserver</em>.takeRecords();
</pre>
<h3 id="パラメータ">パラメータ</h3>
<p>なし</p>
<h3 id="戻り値">戻り値</h3>
<p>{{domxref("PerformanceEntry")}} オブジェクトのリスト</p>
<h2 id="例">例</h2>
<pre class="brush: js">var observer = new PerformanceObserver(function(list, obj) {
var entries = list.getEntries();
for (var i=0; i < entries.length; i++) {
// Process "mark" and "frame" events
}
});
observer.observe({entryTypes: ["mark", "frame"]});
var records = observer.takeRecords();
console.log(records[0].name);
console.log(records[0].startTime);
console.log(records[0].duration);
</pre>
<h2 id="仕様">仕様</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">仕様書</th>
<th scope="col">ステータス</th>
<th scope="col">コメント</th>
</tr>
<tr>
<td>{{SpecName('Performance Timeline Level 2', '#dom-performanceobserver-takerecords', 'takeRecords()')}}</td>
<td>{{Spec2('Performance Timeline Level 2')}}</td>
<td><code>takeRecords()</code> メソッドの初期定義</td>
</tr>
</tbody>
</table>
<h2 id="ブラウザの互換性">ブラウザの互換性</h2>
<div>
<p>{{Compat("api.PerformanceObserver.takeRecords")}}</p>
</div>
|