Angular-google-maps: Cleanup event handling

Created on 20 Jun 2016  ·  4Comments  ·  Source: SebastianM/angular-google-maps

Hi @SebastianM @brian-singer, Please correct me if I'm wrong but it looks like we could tighten up event handling in a few places:

  1. I'm not sure whether we need to manually remove marker event listeners but it looks like we might benefit from calling google.maps.event.clearInstanceListeners(marker); in the marker manager: https://github.com/SebastianM/angular2-google-maps/blob/master/src/core/services/managers/marker-manager.ts#L25
  2. In the marker directive we're subscribing to events with _addEventListeners but don't explicitly un-subscribe to them on destroy: https://github.com/SebastianM/angular2-google-maps/blob/master/src/core/directives/google-map-marker.ts#L125 similar to what we do here: https://github.com/SebastianM/angular2-google-maps/blob/master/src/core/directives/google-map.ts#L224

There might be others too but these are the ones that come to my attention right away, what are your thoughts? Happy to address in a PR if you want. Thanks!

urgent PRs welcome! stale bug

Most helpful comment

@alexweber ya, this is a point that is on my TODO list for a while now. We should address this in the next release. I will think about this a little further and will comment above when I have found a good way for handling this in the future. Thanks guys!

All 4 comments

Yes, I agree the google Marker then has a stale reference to the SebM Marker

@alexweber ya, this is a point that is on my TODO list for a while now. We should address this in the next release. I will think about this a little further and will comment above when I have found a good way for handling this in the future. Thanks guys!

I've addressed item 2 in the commit above, still unclear as to whether we need to use google.maps.event.clearInstanceListeners(marker); so leaving it for now

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChrisDevinePimss picture ChrisDevinePimss  ·  3Comments

vamsibassetty08 picture vamsibassetty08  ·  3Comments

matishw picture matishw  ·  3Comments

Subhojit1992 picture Subhojit1992  ·  3Comments

Halynsky picture Halynsky  ·  3Comments