Jason Knight
1 min readJun 25, 2020

--

I would suggest calling it something other than "events" since it can so easily be confused with the actual Event object, and what ACTUAL system events are. You're not triggering events, you're dispatching methods. There's a difference... a pretty big one.

I was actually expecting this to involve actual Element[addEventListener || removeEventListener].

I probably also wouldn't pollute the namespace by creating the event as a variable, even with the scoping of CONST since you're just assigning it, use a anonymous function unless you plan on assigning it more than once.

Likely wouldn't be a bad idea to lose the arrow function junk since it pisses on code legibility as well. Oh noes, we have to type or look at the word "function", the horrors... :/

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

No responses yet