Skip to content

Commit

Permalink
Teardown for Google Map objects
Browse files Browse the repository at this point in the history
  • Loading branch information
pvaut committed Apr 28, 2014
1 parent 88bfc0e commit 0a486b3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,8 @@ define(["jquery", "DQX/data/countries", "DQX/lib/geo_json", "DQX/lib/StyledMarke



google.maps.event.addListener(that.myMap, 'zoom_changed', $.proxy(that._handleOnZoomChanged, that));
google.maps.event.addListener(that.myMap, 'center_changed', $.proxy(that._handleOnCenterChanged, that));
that.eventListener_Zoom = google.maps.event.addListener(that.myMap, 'zoom_changed', $.proxy(that._handleOnZoomChanged, that));
that.eventListener_Moved = google.maps.event.addListener(that.myMap, 'center_changed', $.proxy(that._handleOnCenterChanged, that));


that.storeSettings = function() {
Expand Down Expand Up @@ -1256,6 +1256,12 @@ define(["jquery", "DQX/data/countries", "DQX/lib/geo_json", "DQX/lib/StyledMarke
google.maps.event.trigger(this.myMap, 'resize');
}

that.tearDown = function() {
google.maps.event.removeListener(that.eventListener_Zoom);
google.maps.event.removeListener(that.eventListener_Moved);
that.myMap = null;
}


return that;
}
Expand Down

0 comments on commit 0a486b3

Please sign in to comment.