Live data from Hacker News

Show HN: Emoji to Scale

javier.xyz

31–40 of 130 posts

Re: Show HN: Emoji to Scale

#39

Neat concept. As someone not very up-to-date in Web UI techniques, I was curious as to how the array was being advanced on scroll. Unfortunately, it looks like the answer is basically polling. The code constantly calls window.requestAnimationFrame(), checking window.pageYOffset. This means that the page is constantly doing work, even at idle. Surely the more correct way is to install an onscroll handler or something,…

The correct way would be a mix of those two strategies: an onscroll handler that schedules an update through requestAnimationFrame (ensuring that it only gets scheduled once until the next frame update actually executes).

The correct way is the way that works, which this does.
Post reply on HN