loading...

re: Understanding `this` with E.D.I.N concepts VIEW POST

FULL DISCUSSION
 

Very informative post! I just wanted to mention that in the case of events handled by addEventListener, if you pass an object that implements #handleEvent, it will be called with event as its argument, and it will be implicitly bound to the object passed in to addEventListener. If you call any other functions on the object within the body of handleEvent, they will also be implicitly bound to the object, too! This saves memory by preventing you from having to use #bind or the arrow syntax for those functions, which both create copies of the function in question,. In circumstances where you have a large number of objects, this can save you a ton of overhead!

code of conduct - report abuse