Register application listener after the control's

This commit is contained in:
ahocevar
2012-10-12 13:41:54 +02:00
parent 0b3f582e10
commit cf3ea0c7db

View File

@@ -8,13 +8,10 @@ function init() {
div: "map", div: "map",
projection: "EPSG:900913", projection: "EPSG:900913",
layers: [ layers: [
new OpenLayers.Layer.WMS("OSGeo", "http://vmap0.tiles.osgeo.org/wms/vmap0", { new OpenLayers.Layer.WMS(
layers: "basic" "OSGeo", "http://vmap0.tiles.osgeo.org/wms/vmap0",
}, { {layers: "basic"}
eventListeners: { )
tileloaded: updateStatus
}
})
], ],
center: [0, 0], center: [0, 0],
zoom: 1 zoom: 1
@@ -38,6 +35,7 @@ function init() {
}; };
// update the number of cached tiles and detect local storage support // update the number of cached tiles and detect local storage support
map.layers[0].events.on({'tileloaded': updateStatus});
function updateStatus() { function updateStatus() {
if (window.localStorage) { if (window.localStorage) {
status.innerHTML = localStorage.length + " entries in cache."; status.innerHTML = localStorage.length + " entries in cache.";