Intersection Observer API

The Intersection Observer is widely available browser feature to asynchronously watch elements in a document and report on whether it is visible or not. Official Docs