The Element Timing API provides timing on when elements are displayed. This first proposal is restricted to <img> elements to make it simpler:
[Proposal] Element Timing
What would this do that an Intersection Observer doesn’t allow for? You can use an Intersection Observer to know when a node is in the active viewport. And then do something based on that event. It sounds exactly like what your intended goal is, except far more widely applicable to web applications.
The main reason this is preferred over Intersection Observer is because we want to avoid forcing developers to run Javascript very early in the page load. You’d need to run a script that registers the Intersection Observer very early on for it to work. This would not be required with Element Timing because the PerformanceObserver could be created with a buffered flag that provides values measured before its creation.
Also, IntersectionObserver wouldn’t be ergonomic for this use case: handling the question of when the element has loaded, wanting only the first update for the element, etc.
We are still interested in moving forward with the proposal and have evolved it a bit.
Since there seems to be some support to this feature, I’d like to move the repo to WICG and continue incubating it from there. I’ll have a spec to accompany the explainer soon.
Thank you for incubating WICG! The repo has now moved and is at https://github.com/WICG/Element-Timing