Consider a web page that uses infinite scrolling. It uses a vendor-provided library to manage the advertisements placed periodically throughout the page, has animated graphics here and there, and uses a custom library that draws notification boxes and the like. Each of these has its own intersection detection routines,
all running on the main thread. The author of the web site may not even realize this is happening,
The Intersection Observer API lets code register a callback function that is executed whenever an element they wish to monitor enters or exits another
element (or the viewport), or when the amount by
which the two intersect changes by a requested amount.