From 846916f53d50d8e8162be9a2c22c842198c49ea1 Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 30 Apr 2013 16:42:52 -0300 Subject: Using countProperties() to count object properties --- gmap_arcgis.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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); } } -- cgit v1.2.3