IntersectionObserver.idl 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. #import <DOM/Document.idl>
  2. #import <DOM/Element.idl>
  3. #import <DOM/Node.idl>
  4. #import <IntersectionObserver/IntersectionObserverEntry.idl>
  5. // https://w3c.github.io/IntersectionObserver/#intersection-observer-callback
  6. callback IntersectionObserverCallback = undefined (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);
  7. // https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
  8. [Exposed=(Window)]
  9. interface IntersectionObserver {
  10. constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options = {});
  11. readonly attribute (Element or Document)? root;
  12. readonly attribute DOMString rootMargin;
  13. readonly attribute DOMString scrollMargin;
  14. // FIXME: `sequence<double>` should be `FrozenArray<double>`
  15. readonly attribute sequence<double> thresholds;
  16. readonly attribute long delay;
  17. readonly attribute boolean trackVisibility;
  18. undefined observe(Element target);
  19. undefined unobserve(Element target);
  20. undefined disconnect();
  21. sequence<IntersectionObserverEntry> takeRecords();
  22. };
  23. // https://w3c.github.io/IntersectionObserver/#intersection-observer-init
  24. dictionary IntersectionObserverInit {
  25. (Element or Document)? root = null;
  26. DOMString rootMargin = "0px";
  27. DOMString scrollMargin = "0px";
  28. (double or sequence<double>) threshold = 0;
  29. long delay = 0;
  30. boolean trackVisibility = false;
  31. };