From 01146e0f6ec9dac3730c6b1846e6ef1ac5ecc08c Mon Sep 17 00:00:00 2001 From: choclate Date: Fri, 26 Aug 2016 14:04:17 +0200 Subject: [PATCH] fix: add debounce to computeUrl to remove angular2 multiple api error fix #67 --- google-maps-api.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/google-maps-api.html b/google-maps-api.html index fb9bbac..03362d9 100644 --- a/google-maps-api.html +++ b/google-maps-api.html @@ -103,11 +103,21 @@ /** @private */ libraryUrl: { - type: String, - computed: '_computeUrl(mapsUrl, version, apiKey, clientId, language, signedIn)' + type: String } }, + observers: [ + '_debounceComputeUrl(mapsUrl, version, apiKey, clientId, language, signedIn)' + ], + + _debounceComputeUrl: function(mapsUrl, version, apiKey, clientId, language, signedIn) { + var _this = this; + _this.debounce('_computeUrl', function () { + _this.libraryUrl = _this._computeUrl(_this.mapsUrl, _this.version, _this.apiKey, _this.clientId, _this.language, _this.signedIn); + }, 300); + }, + _computeUrl: function(mapsUrl, version, apiKey, clientId, language, signedIn) { var url = mapsUrl + '&v=' + version;