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... :/

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store