Doing graphics in JS I found that I need to use windows.requestAnimationFrame and to be able to access 'this' I need to bind my drawing function to 'this'.
requestAnimationFrame(this.MyDrawFunction.bind(this));
But later I found another example, where I can just pass a delegate
window.requestAnimationFrame(() => this.MyDrawFunction());
Could you please help me understand, what is the differences between those 2? I understand the 2nd call my function in (with?) a proper closure. How does the 1st function principally different? Which variant should I use?
Thanks!
P.S. I have my code as a part of the Angular 10 application if it makes any difference.