This is a small Helper Library that helps you with adding and removing EventListeners in your application.
Install via npm
npm install @ngehlert/event-helper
Best used with ES6 imports
EventHelper;// To remove the event listener simply call remove function with your specified nameEventHelper;
Usage with method specific context inside a class
One Time Event
After executing once the event listener automatically de-registers itself
With this event helper you can just use functions directly and while declaring the event add
.bind(this) without needing to create a second variable.
Another advantage is if you want to remove the event not in the same spot where you registered it, you don't need to pass the proper reference along just to cancel the event.
npm run build
Before commiting run
npm run lint && npm run format && npm run test
This is provided under the MIT license. Check LICENSE file for more details.