Conversation
|
🔗 Download Full Report Artifact 🧪 Playwright Test Summary
|
|
| const index = current.indexOf(entry); | ||
|
|
||
| if (index !== -1) { | ||
| current.splice(index, 1); |
There was a problem hiding this comment.
Mutating the same array inside a loop will skip the some array elements.
[eventOnce, event1, event2]
if you remove eventOnce after the first iteration then event1 will be skipped in the second iteration as it will be on index 0 and on index 1 it will be event2.
So we can store the events to be removed on another array and delete it after the loop.
|
I'm not convinced this module is a useful abstraction in its current form. To me this reads more like a generic event-emitter-style wrapper than a clean architecture boundary. I also find the name I'm also concerned about the typing. Accepting arbitrary string event names and generic My preference would be to keep global/browser event registration at the application entry point and pass concrete function callbacks inward into the application layer. That keeps the browser-specific wiring at the edge, makes dependencies explicit and gives us better type safety than introducing a generic event-listener abstraction. |



Summary
Add eventListenerService for purify functions and pass window.eventListener as a dependency.
Security Checklist (required)
Accessibility (required)
Standards Acknowledgement (required)
Screenshots or demo (if the user interface changed)
Notes for reviewers