Permalink
Browse files

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

  • Loading branch information...
1 parent 59d2fb3 commit b92804524462c82e7239e79c70b9d056b47e8acd @andrewsmedina andrewsmedina committed Aug 16, 2010
Showing with 10 additions and 7 deletions.
  1. +1 −7 wifimap/media/js/map.js
  2. +9 −0 wifimap/media/js/page.js
View
@@ -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
@@ -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);
+
}
};

0 comments on commit b928045

Please sign in to comment.