Hello all,
I'm currently adding some angular in a web application. This one got a simple pubsub, and I need to push the events in the angular world.
I looked at the $broadcast scope method, and it seems to me the better way to do it: because when child scopes will be removed from the dom, angular removes the event listeners, so I don't risk memory leaks. I just have to plug my existing pubsub publish method to a rootScope.$broadcast, and I'm done.
However, my current application (an audio player) emits lots of events through the pubsub (eg the audio timeupdate that happens every 200ms, the load progress, etc...) so I'm concerned by performances. I looked at the angular code and was disappointed to find that angular doesn't have some maps of "event name" => [ array of scopes listening ], but that angular goes through each and every defined scope to find event listeners...
What's your opinion about this ? Should I keep my external pubsub and play with $apply to use it angular-side, or have someone found better angular-made implementation ? Or will angular devs ready to discuss a better performance implementation of the $broadcast thing (so I can help) ?
Regards,
Mickael