// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://wicg.github.io/IntersectionObserver/#intersection-observer-callback

[Custom] callback IntersectionObserverCallback = void (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);

// https://wicg.github.io/IntersectionObserver/#intersection-observer-interface

[
    CustomConstructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options),
    Custom=VisitDOMWrapper,
    MeasureAs=IntersectionObserver_Constructor,
    RuntimeEnabled=IntersectionObserver,
] interface IntersectionObserver {
    readonly attribute Element? root;
    readonly attribute DOMString rootMargin;
    // https://github.com/WICG/IntersectionObserver/issues/114
    readonly attribute FrozenArray<double> thresholds;
    [RaisesException] void observe(Element target);
    [RaisesException] void unobserve(Element target);
    [RaisesException] void disconnect();
    [RaisesException] sequence<IntersectionObserverEntry> takeRecords();
};
