News for hackers. Stuff that matters.
Re:‘This’ in JavaScript by wiredearp on Thursday August 03, 2017 @10:24AM (#14919822)
I guess the function could still be anonymous, but you will at least need to keep it assigned to some variable or property name. If you make use of the `handleEvent` pattern that @carussell suggested, you can however avoid having to keep track of all these callback functions since the listener can always be removed by passing `this` a second time:

['click', 'focus', 'blur'].forEach(type => elm.removeEventListener(type, this));

There are no comments on this comment yet.