diff options
author | Silvio <silvio@socioambiental.org> | 2013-04-30 16:42:52 -0300 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2013-04-30 16:42:52 -0300 |
commit | 846916f53d50d8e8162be9a2c22c842198c49ea1 (patch) | |
tree | f91556e0df455e289f93171fbfb776e016488012 | |
parent | d4004d0558a9b06abe601120cd7cc12e233ebf97 (diff) | |
download | gmap_arcgis_js-846916f53d50d8e8162be9a2c22c842198c49ea1.tar.gz gmap_arcgis_js-846916f53d50d8e8162be9a2c22c842198c49ea1.tar.bz2 |
Using countProperties() to count object properties
-rw-r--r-- | gmap_arcgis.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js index dc22f17..aa17af4 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -40,6 +40,20 @@ function gmapArcgis(config) { jQuery.blockUI(); }, + // Count object properties + countProperties: function(object) { + // Doesn't work with IE8 + //return Object.keys(layers).length; + + var count = 0; + + for (value in object) { + count++; + } + + return count; + }, + // Set the current map setMap: function(map) { this.map = map; @@ -137,7 +151,7 @@ function gmapArcgis(config) { } // Callback only if layers is not empty - if (Object.keys(layers).length > 0) { + if (self.countProperties(layers) > 0) { params.identify.callback(layers, params.infowindow, err); } } |