A minimalistic ClojureScript interface to React.js
neilyio 2020-09-10T20:16:48.006500Z

Is reagent/next-tick a drop-in replacement for requestAnimationFrame? I can't find much literature on it. What would be the equivalent of cancelAnimationFrame?

p-himik 2020-09-10T20:26:50.007200Z

It is equivalent, I think. And its docstring confirms that. But there's no canceling functionality.

neilyio 2020-09-10T20:32:07.008600Z

Thanks! I suppose I'll use requestAnimationFrame instead so that I can cancel it... Unless it's less important than I thought to use cancelAnimationFrame?

p-himik 2020-09-10T20:46:39.010300Z

I cannot answer in any useful way without knowing what you're actually doing. Maybe canceling the callback is required, maybe it's preferred but not necessary, maybe it isn't necessary at all. Either way, I don't see how canceling something when you know that you don't need it would be a bad idea.

neilyio 2020-09-10T20:56:00.015400Z

Upon more reading, it seems to me that a common pattern is for requestAnimationFrame 's callback to call itself recursively. Each recursive iteration checks a stopping condition, and either returns or calls requestAnimationFrame once again. If this is also the common practice with reagent/next-tick, I can see how a "cancel" function becomes unnecessary.