Created
September 13, 2017 21:58
-
-
Save cassaram09/58da6c6658077b1df0319d8519b348c9 to your computer and use it in GitHub Desktop.
Revisions
-
cassaram09 created this gist
Sep 13, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ import load from "little-loader"; import qs from "query-string"; // YOUR_API_KEY - string // libraries - array of strings, eg ['places'] const loadGoogleMaps = (YOUR_API_KEY, libraries) => { return new Promise( (resolve, reject) => { var params = {key: YOUR_API_KEY, libraries: libraries} load(`https://maps.googleapis.com/maps/api/js?${qs.stringify(params)}`, (error) => { if (error) { reject("Unable to load Google Maps"); } else { console.log('Google Maps loaded.') resolve(); } }) }) } export default loadGoogleMaps;