-
Notifications
You must be signed in to change notification settings - Fork 439
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
Remove all listeners when .off gets called without a type #72
Conversation
Might be worthwhile. I wonder if this is cheaper than adding a |
Gonna check and report back, clearing solution ( |
Adding separate
Let me know which version do you prefer. |
I think it is good now. I pretty like that And btw still can't remember why the hell i did the removing by comparing strings, which in turn leads to issues like tunnckoCoreLabs/dush#22 🤣 ... there was a reason to not use the |
friendly 🏓 is there anything left to do with this PR on my side? |
friendly 🏓 😉 |
Probably just merge? There is no automatic release so it won't be published and you can use the master temporary until new eventual release. I didn't realize that i can submit and approve review, sorry if that was the block ;d |
@developit friendly 🏓 would love to see this published to ditch our fork 😉 |
@Andarist hey, sorry for the delay here. One issue I can see with this: If someone passes in a custom const myEvents = {};
const events = mitt(myEvents);
events.off();
events.on('foo', () => {});
myEvents.foo // undefined This might be okay? I'm not sure how many people are relying on the |
Hm, yeah - that's a possible downside of this. We can't fix it without iterating through the OTOH I doubt there are many people relaying on Hard to tell what's best here - how useful Ultimately it's your call here 😉 |
lol that was my thought too - "oh, people don't use this... except me lol". Also there seem to have been a fair number of PR's that indicate people are relying on I'm not entirely against dropping |
I've tried deleting all properties:
Maybe you could try to squeeze extra bytes out of it as you are expert in this area, but unfortunately I don't have any more ides how to do that 😢 |
@Andarist @developit I implemented two alternative ways to fix this:
Would be nice to get some feedback on this. |
This was implemented in #124 and released in 3.0.0. |
fixes #70