6 ms·
Then you had different problems. You don't always want to capture `this`.
by moron4hire 9y ago
Then you had different problems. You don't always want to capture `this`.
- always_good 9y agoExample?
- moron4hire 9y agoI almost always want event listeners to have `this` refer to the element on which they were added, not the class from which they came. It's the default case for all but arrow functions, so it takes no extra effort in most cases, and if I really need other state, I find it is clearer if it comes through a closure. Plus, making it a habit makes it easier to keep it straight.
- k__ 9y agoI found this only to be a problem in legacy libraries.