I was doing some refactoring work today to decouple TabCounter from BrowserToolbar when I realized I needed to add a new listener to an event. However, this toolbar only supported one listener rather than multiple. I know that I could simply call my listener method from the existing listener, but this just couples TabCounter with BrowserApp instead, losing all of the benefits of using a listener interface. I decided that I needed to modify BrowserToolbar to accept multiple listeners.
I remember doing this at least one time before and it brings up the issue of having an inconsistent management of listeners in our code (Android itself has this problem too). I have a feeling that the reason we tend to only support one listener is that it requires much less boilerplate code, until it ends up being needed later. I attempted to design a generic ListenerManager that could be used to manage listeners for any interface. There are definitely a few drawbacks (which I listed in the paste bin) but I would just like to open up the discussion for creating something like this. Feedback please! https://pastebin.mozilla.org/5022764 _______________________________________________ mobile-firefox-dev mailing list mobile-firefox-dev@mozilla.org https://mail.mozilla.org/listinfo/mobile-firefox-dev