Skip to content

Commit b8d3c8e

Browse files
Fix: Fix a timing issue for sequential importLibrary calls (#843)
#809 Fixes #809 f24a1ae
1 parent 2c490bb commit b8d3c8e

12 files changed

+55
-52
lines changed

classes/Loader.html

Lines changed: 18 additions & 18 deletions
Large diffs are not rendered by default.

dist/index.dev.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,19 +422,21 @@ this.google.maps.plugins.loader = (function (exports) {
422422
}
423423
execute() {
424424
this.resetIfRetryingFailed();
425+
if (this.loading) {
426+
// do nothing but wait
427+
return;
428+
}
425429
if (this.done) {
426430
this.callback();
427431
} else {
428432
// short circuit and warn if google.maps is already loaded
429433
if (window.google && window.google.maps && window.google.maps.version) {
430-
console.warn("Google Maps already loaded outside @googlemaps/js-api-loader." + "This may result in undesirable behavior as options and script parameters may not match.");
434+
console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. " + "This may result in undesirable behavior as options and script parameters may not match.");
431435
this.callback();
432436
return;
433437
}
434-
if (this.loading) ; else {
435-
this.loading = true;
436-
this.setScript();
437-
}
438+
this.loading = true;
439+
this.setScript();
438440
}
439441
}
440442
}

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,22 +385,23 @@ class Loader {
385385
}
386386
execute() {
387387
this.resetIfRetryingFailed();
388+
if (this.loading) {
389+
// do nothing but wait
390+
return;
391+
}
388392
if (this.done) {
389393
this.callback();
390394
}
391395
else {
392396
// short circuit and warn if google.maps is already loaded
393397
if (window.google && window.google.maps && window.google.maps.version) {
394-
console.warn("Google Maps already loaded outside @googlemaps/js-api-loader." +
398+
console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. " +
395399
"This may result in undesirable behavior as options and script parameters may not match.");
396400
this.callback();
397401
return;
398402
}
399-
if (this.loading) ;
400-
else {
401-
this.loading = true;
402-
this.setScript();
403-
}
403+
this.loading = true;
404+
this.setScript();
404405
}
405406
}
406407
}

dist/index.mjs.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)