From f17933a55dd31a3144238bfccda4e0cd08c5b7bb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Demonte Date: Sat, 3 Dec 2016 10:42:11 +0100 Subject: [PATCH] clean a few code --- src/gmap3.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gmap3.js b/src/gmap3.js index 0954477..63f9407 100644 --- a/src/gmap3.js +++ b/src/gmap3.js @@ -89,7 +89,7 @@ } function ready(fn) { - if (document.readyState != 'loading'){ + if (document.readyState != 'loading') { fn(); } else { document.addEventListener('DOMContentLoaded', fn); @@ -103,7 +103,7 @@ } // Auto-load google maps library if needed - (function () { + when(function () { var dfd = deferred(), cbName = '__gmap3', script; @@ -126,8 +126,8 @@ } }); - return dfd.promise(); - })().then(function () { + return dfd; + }()).then(function () { $.holdReady(false); }); @@ -172,7 +172,7 @@ address: request }; } - service('Geocoder').geocode(request, function(results, status) { + service('Geocoder').geocode(request, function (results, status) { if (status === gm.GeocoderStatus.OK) { dfd.resolve(results[0].geometry.location); } else { @@ -194,7 +194,7 @@ * @param {StringCallback} fn - Callback function */ function foreachStr(str, fn) { - str.split(' ').forEach(fn); + foreach(str.split(' '), fn); } /** @@ -287,9 +287,7 @@ */ function resolveArrayOfLatLng(options, key, fn) { options = dupOpts(options); - options[key] = (options[key] || []).map(function (item) { - return toLatLng(item); - }); + options[key] = (options[key] || []).map(toLatLng); return resolved(fn(options)); } @@ -391,7 +389,7 @@ self.draw(); }; - self.draw = function() { + self.draw = function () { var sw = fromLatLngToDivPixel(options.bounds.getSouthWest()); var ne = fromLatLngToDivPixel(options.bounds.getNorthEast());