google-maps-js-api-loader
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("fast-deep-equal"),require("query-string")):"function"==typeof define&&define.amd?define(["exports","fast-deep-equal","query-string"],t):t((e||self).googleMapsLoader={},e.fastDeepEqual,e.queryString)}(this,function(e,t,r){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/n(t);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}var i,s="__googleMapsCallback",u=function(){};e.LoaderStatus=void 0,(i=e.LoaderStatus||(e.LoaderStatus={}))[i.NONE=0]="NONE",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i[i.ERROR=3]="ERROR";var l=/*#__PURE__*/function(){function t(){}var n,i;return t.load=function(t,n){try{var i=this;if(i._options){if(!o.default(i._options,t))throw new Error("Loader must not be called again with different options")}else{if(window.google&&window.google.maps)throw new Error("Google Maps already loaded");var l;i._options=t,i._status=e.LoaderStatus.LOADING,(n||u)(),i._promise=new Promise(function(t,r){window[s]=function(){i._status=e.LoaderStatus.LOADED,t(),delete window[s]},l=function(t){i._status=e.LoaderStatus.ERROR,r(t)}}),function(e,t){var n=function(e){return{params:{key:e.apiKey,channel:e.channel,client:e.client,v:e.version,language:e.language,region:e.region,map_ids:e.mapIds,libraries:e.libraries},url:e.url||"https://maps.googleapis.com/maps/api/js",nonce:e.nonce}}(e),o=n.params,i=n.url,u=n.nonce,l=document.createElement("script");l.src=r.stringifyUrl({url:i,query:a({},o,{callback:s})},{skipEmptyString:!0}),l.type="text/javascript",l.defer=!0,l.async=!0,l.addEventListener("error",t),u&&(l.nonce=u),document.head.appendChild(l)}(t,l)}return Promise.resolve(i._promise)}catch(e){return Promise.reject(e)}},n=t,(i=[{key:"status",get:function(){return this._status}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n,i),Object.defineProperty(n,"prototype",{writable:!1}),t}();l._status=e.LoaderStatus.NONE,l._options=void 0,l._promise=void 0,e.default=l}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("fast-deep-equal"),require("query-string")):"function"==typeof define&&define.amd?define(["exports","fast-deep-equal","query-string"],t):t((e||self).googleMapsJsApiLoader={},e.fastDeepEqual,e.queryString)}(this,function(e,t,r){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/n(t);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}var i,s="__googleMapsCallback",u=function(){};e.LoaderStatus=void 0,(i=e.LoaderStatus||(e.LoaderStatus={}))[i.NONE=0]="NONE",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i[i.ERROR=3]="ERROR";var l=/*#__PURE__*/function(){function t(){}var n,i;return t.load=function(t,n){try{var i=this;if(i._options){if(!o.default(i._options,t))throw new Error("Loader must not be called again with different options")}else{if(window.google&&window.google.maps)throw new Error("Google Maps already loaded");var l;i._options=t,i._status=e.LoaderStatus.LOADING,(n||u)(),i._promise=new Promise(function(t,r){window[s]=function(){i._status=e.LoaderStatus.LOADED,t(),delete window[s]},l=function(t){i._status=e.LoaderStatus.ERROR,r(t)}}),function(e,t){var n=function(e){return{params:{key:e.apiKey,channel:e.channel,client:e.client,v:e.version,language:e.language,region:e.region,map_ids:e.mapIds,libraries:e.libraries},url:e.url||"https://maps.googleapis.com/maps/api/js",nonce:e.nonce}}(e),o=n.params,i=n.url,u=n.nonce,l=document.createElement("script");l.src=r.stringifyUrl({url:i,query:a({},o,{callback:s})},{skipEmptyString:!0}),l.type="text/javascript",l.defer=!0,l.async=!0,l.addEventListener("error",t),u&&(l.nonce=u),document.head.appendChild(l)}(t,l)}return Promise.resolve(i._promise)}catch(e){return Promise.reject(e)}},n=t,(i=[{key:"status",get:function(){return this._status}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n,i),Object.defineProperty(n,"prototype",{writable:!1}),t}();l._status=e.LoaderStatus.NONE,l._options=void 0,l._promise=void 0,e.default=l}); | ||
//# sourceMappingURL=google-maps-loader.umd.js.map |
{ | ||
"name": "google-maps-js-api-loader", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Wrapper for the loading of Google Maps JavaScript API script in the browser", | ||
@@ -40,4 +40,3 @@ "repository": { | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -44,0 +43,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
31254
14
58