I have been using custom instance events to make code more modular, and reusable. and adding event listeners has worked well, but I have a use case now where I need to stop listening to the custom event dynamically and calling the removeEventListener function on the instance does not remove the event.
I have tried several ways, the signature of removeEventListener needs the event name and what seems to be the callback function reference.
does the callback function need to the exact same reference of the function that was added? is there a way to remove the event without passing the same reference? I have attached an example project that demonstrates the events firing, and the listeners reacting to it, but when I try and remove the listener it does not find it in the listenerSet map and never removes it. even though it's there
https://drive.google.com/file/d/1raLxb-q0xprDKsxlneSON7MDikwXh8ee/view?usp=sharing