Handle all events with eventListener object handle event method
It would be nice if 'listen' util method could handle events similar to article solution - https://webreflection.medium.com/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38.
Not sure what is the merit of this solution here. The library already implements event delegation and has been tested for memory usage pre event delegation and post delegation
I believe the crutch Memory usage per event vs only a single allocation for every event?
Not sure what you mean? Have you seen the setup listeners function in core/index.ts? That is event delegation and it works well
All I see in packages/core/src/index.ts is a listen that just calls add listener for both main branch and new-api branch
Please study the new-api branch’s core/index.ts thoroughly. This does not need the handleEvent
On Sat, 19 Jul 2025 at 10:42 AM, Jonathon Reese Perry < @.***> wrote:
JonathonRP left a comment (PuruVJ/neodrag#231) https://github.com/PuruVJ/neodrag/issues/231#issuecomment-3091843527
All I see in packages/core/src/index.ts is a listen that just calls add listener for both main branch and new-api branch
— Reply to this email directly, view it on GitHub https://github.com/PuruVJ/neodrag/issues/231#issuecomment-3091843527, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMH4F6YVWUC5P4464YSJKT3JHHVPAVCNFSM6AAAAACB3ZAVEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAOJRHA2DGNJSG4 . You are receiving this because you commented.Message ID: @.***>
Still looks like you are initializing 4 listeners, that hold single function call through binding to self functions for handling, when you could just have listen(el, this), and example implementation
handleEvent(type) {
this[`on${type}`].call().bind(this);
}
Unless I am missing something.
I'm not sure I get the advantages of this in the context. Please raise a PR with the testes changes and we can discuss further there