We’re happy to announce two open supply libraries that make it simpler so that you can use the Maps JavaScript API in fashionable net apps. Up till now, the Maps JavaScript API has required using a script tag inserted into the HTML doc; nonetheless, this sample requires cautious collection of script tag attributes and a deep understanding of how the browser parses and executes JavaScript. To simplify issues, we launched the @googlemaps/js-api-loader and @googlemaps/react-wrapper modules on NPM.

The primary library, @googlemaps/js-api-loader, dynamically masses the Maps JavaScript API and wraps the method in a Promise. This implies now you can import the js-api-loader and cargo the Maps JS API through JavaScript relatively than HTML. The loader additionally helps all the choices for loading the API, resembling model, libraries, and apiKey, handed in as an choices object. Different advantages embody retries on community errors and a singleton sample to keep away from duplicate a great deal of the Maps JavaScript API. The next reveals the utilization of this library:



Leave a Reply

Your email address will not be published. Required fields are marked *