Well there are definitely issues here (ordered least significant to most)
Owen Campbell-Moore

Ad. issue with time — I see what your here expectations are, but I thought a little bit about it and wondering — isn’t it more meaningful than start of running callbacks? You could more easily decide (in callback) if you want to perform an action in case time elapsed from start of the frame is already more than 16ms.

Ad. single queued rAF callback per frame — I have not noticed that earlier and cannot confirm now. Or I do not understand you. If I understand correctly this should fail.

const times = []
for (let i = 0; i < 1e3; i++) {
window.requestAnimationFrame(v => {
if (times.length < 2) return
if (times[times.length-1] !== times[times.length-2])
throw new Error()

Is it the situation you mean? Or maybe it is conditional? I do not know of any, but in such case I would suspect that it is a optimization like slowing down setTimeout+setInterval in case of tab being in a background.

Ad. “vast majority of developers use rAF thinking it will perform the function of rAF rAF” I have a feeling that it is the case too.

Show your support

Clapping shows how much you appreciated Artur Kulig’s story.