Michael Karén
1 min readOct 4, 2019

--

Hi, S uchoss!

You can check my new article where I might have a better explanation of it. I’ll have to read through this article and see if I can update it now that I have a better grasp of it. It can be a bit confusing. :)

We need to bind the call to this, or it has the window object as its context. Since it doesn't contain the paint function, we get an error.

paint() {
// drawing logic
requestAnimationFrame(this.paint.bind(this));
}

--

--

Michael Karén
Michael Karén

Written by Michael Karén

Frontend Architect • JavaScript Enthusiast • Educative.io Author • ngVikings organizer.

Responses (1)