tiny-emitter icon indicating copy to clipboard operation
tiny-emitter copied to clipboard

Callback logic

Open jssuttles opened this issue 1 year ago • 1 comments

https://github.com/scottcorgan/tiny-emitter/blob/4e6b2eb5869fb4ba862accaef7d16a7051349f4f/index.js#L58C6-L58C16

Doesn't this ternary statement mean that if the callback isn't found in the list of associated callbacks, then it'll remove all associated callbacks?

jssuttles avatar Jan 18 '24 20:01 jssuttles

What I remember this being for is to delete only the referenced callback, and reassign the remaining event callbacks to the current event listening object.

It's a bunch of awkward code to avoid memory leaks and unnecessary allocations.

This was a long time ago, so apologies if I'm not remembering correctly.

scottcorgan avatar Apr 21 '24 10:04 scottcorgan