-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(websocket): add ability to remove listener #2027
base: v2
Are you sure you want to change the base?
Conversation
Change listeners array to use a set instead, which prevents addition of duplicated listeners which could possibly lead to memory leaks.
Package Changes Through 3fd36edThere are 11 changes which include upload with minor, upload-js with minor, websocket-js with minor, deep-link with patch, deep-link-js with patch, log-plugin with patch, log-js with patch, fs with patch, fs-js with patch, localhost with minor, sql with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
i agree that a way to remove listeners is needed (that's why i didn't close the issue) but i'm not a fan of the Set here (or how it was used). I can very much imagine that someone wants to register the same function twice for whatever reason. Buuuut i'm totally fine with doing it this way and waiting to see if anyone actually complains. Also, changing the return value is technically a breaking change but because it didn't return anything before and because this plugin doesn't have that many users i think we can get away with it. |
Yes, that's exactly what I thought 😅
Yeah but it doesn't make sense to do so because same function gets invoked multiple times which can cause weird behaviors. |
This pr changes listeners array to use a set instead, which prevents addition of duplicated listeners which could possibly lead to memory leaks.