Js Api Loader screenshot

Js Api Loader

Author Avatar Theme by Googlemaps
Updated: 12 Jan 2026
430 Stars

Load the Google Maps JavaScript API script dynamically.

Overview

The Google Maps JavaScript API Loader simplifies the process of loading the Google Maps JavaScript API script dynamically. It is an npm package that provides developers with a more efficient way to interact with the Google Maps services, especially for those using custom HTML elements. With easy installation and clear usage guidelines, this tool is perfect for any project that requires mapping functionalities.

This loader not only allows for streamlined coding practices but also offers a rich set of features that enhance the overall development experience. Whether you are retrieving maps, handling geographic data, or managing user interactions, this loader is a reliable choice for integrating Google Maps into your web applications.

Features

  • Dynamic Loading: Load maps library dynamically with minimal overhead while maintaining performance.
  • Custom HTML Elements: Support for custom HTML elements like <gmp-map> and <gmp-advanced-marker> to enhance the integration experience.
  • Simple API: Two main functions—setOptions to configure API loading options and importLibrary to fetch specific libraries easily.
  • Flexible Options: Customize loading with options such as API key, version, language, region, and additional libraries for seamless integration.
  • Promise-Based Loading: Returns a promise from importLibrary, allowing for better error handling and control during the loading process.
  • Multiple Library Support: Access to a wide range of libraries including Maps, Places, Geocoding, and more to cover various mapping needs.
  • Referrer Policy Configuration: Control the referrer policy for API requests with ease, enhancing security and privacy in your applications.
  • Error Handling: Automatic handling of loading errors, such as connectivity issues, ensuring your application remains robust.