I've even learned a thing or two that I'd like to share since they went against my initial intuition:
- I thought relying on the `scrollend` event ^2 would work to clean up the viewport... and it didn't (for some reason, the listener was periodically removed, quite annoying and I assume it could be to prevent memory leaks).
- Same thing when (trying to) use the intersection observer API ^3,
which can actually be used to measure how long elements have been made visible to a user like ads for example or most likely I just didn't understand how it could be done . However it incidentally allowed me to pinpoint with the debugger some function belonging to a minified lib using itself the intersection observer API when my own customization failed (not so gracefully) via the error stacktrace.
In the end, i just went for busting the promoting content every 0.5s,
which surprisingly seem to work out of the box (until it won't anymore with the next release). It just worked from the start in the console and I went down a rabbit hole with premature optimization being the root of all evil and all that (this is not AI-generated... I can assure you).
thierrymarianne•2h ago
In the end, i just went for busting the promoting content every 0.5s, which surprisingly seem to work out of the box (until it won't anymore with the next release). It just worked from the start in the console and I went down a rabbit hole with premature optimization being the root of all evil and all that (this is not AI-generated... I can assure you).
^1: it works with Chrome on my machine™ ^2: https://developer.chrome.com/blog/scrollend-a-new-javascript... ^3: https://developer.mozilla.org/en-US/docs/Web/API/Intersectio...