Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

set add/remove listener in load/unload spot list page

  • Loading branch information...
commit b92804524462c82e7239e79c70b9d056b47e8acd 1 parent 59d2fb3
@andrewsmedina andrewsmedina authored
Showing with 10 additions and 7 deletions.
  1. +1 −7 wifimap/media/js/map.js
  2. +9 −0 wifimap/media/js/page.js
View
8 wifimap/media/js/map.js
@@ -18,13 +18,7 @@ var Map = {
content: 'content'
});
- this.markers = [];
-
-
- google.maps.event.addListener(Map.map, 'dragend', function() {
- SpotManager.getAccessPointsListByBounds();
- });
-
+ this.markers = [];
},
followCenter: function(callback) {
View
9 wifimap/media/js/page.js
@@ -103,9 +103,18 @@ var SpotListPage = {
SpotManager.getAccessPointsListByBounds();
SpotManager.addSpotsToMap();
});
+
+ Map.dragendListener = google.maps.event.addListener(Map.map, 'dragend', function() {
+ SpotManager.getAccessPointsListByBounds();
+ });
+
},
unload: function() {
Map.removeAllMarkers();
+
+ if (Map.dragendListener)
+ google.maps.event.removeListener(Map.dragendListener);
+
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.