--- title: IntersectionObserver.takeRecords() slug: Web/API/IntersectionObserver/takeRecords translation_of: Web/API/IntersectionObserver/takeRecords ---
{{domxref("IntersectionObserver")}} 的方法takeRecords()
返回一个 {{domxref("IntersectionObserverEntry")}} 对象数组, 每个对象的目标元素都包含每次相交的信息, 可以显式通过调用此方法或隐式地通过观察者的回调自动调用.
Note: 如果使用回调来监视这些更改,则无需调用此方法。调用此方法会清除挂起的相交状态列表,因此不会运行回调。
intersectionObserverEntries = intersectionObserver.takeRecords();
None.
{{domxref("IntersectionObserverEntry")}} 对象数组, 每个对象包含目标元素与根每次的相交信息。
<<<...>>>
Specification | Status | Comment |
---|---|---|
{{SpecName('IntersectionObserver','#dom-intersectionobserver-takeRecords','IntersectionObserver.takeRecords()')}} | {{Spec2('IntersectionObserver')}} | Initial definition. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.IntersectionObserver.takeRecords")}}