{"id":13484977,"url":"https://github.com/googlemaps/js-api-loader","last_synced_at":"2025-05-15T15:04:29.234Z","repository":{"id":36969377,"uuid":"254489497","full_name":"googlemaps/js-api-loader","owner":"googlemaps","description":"Load the Google Maps JavaScript API script dynamically.","archived":false,"fork":false,"pushed_at":"2025-04-21T07:28:10.000Z","size":5123,"stargazers_count":388,"open_issues_count":28,"forks_count":66,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-04-21T08:14:06.304Z","etag":null,"topics":["bootstrap","google","google-maps","google-maps-api","googlemaps","javascript","maps","promises","utility-library","web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googlemaps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-04-09T22:15:47.000Z","updated_at":"2025-04-09T05:09:45.000Z","dependencies_parsed_at":"2023-02-19T08:31:20.581Z","dependency_job_id":"7e0b0e7b-1845-4278-925d-557deaea5730","html_url":"https://github.com/googlemaps/js-api-loader","commit_stats":{"total_commits":579,"total_committers":10,"mean_commits":57.9,"dds":"0.24870466321243523","last_synced_commit":"947b17b4d5bcedb56757c9c866e34b9c17c01c11"},"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fjs-api-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fjs-api-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fjs-api-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fjs-api-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googlemaps","download_url":"https://codeload.github.com/googlemaps/js-api-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364270,"owners_count":22058878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","google","google-maps","google-maps-api","googlemaps","javascript","maps","promises","utility-library","web"],"created_at":"2024-07-31T17:01:41.298Z","updated_at":"2025-05-15T15:04:29.202Z","avatar_url":"https://github.com/googlemaps.png","language":"TypeScript","readme":"[![npm](https://img.shields.io/npm/v/@googlemaps/js-api-loader)][npm-pkg]\n![Release](https://github.com/googlemaps/js-api-loader/workflows/Release/badge.svg)\n![Stable](https://img.shields.io/badge/stability-stable-green)\n[![Tests/Build](https://github.com/googlemaps/js-api-loader/actions/workflows/test.yml/badge.svg)](https://github.com/googlemaps/js-api-loader/actions/workflows/test.yml)\n\n[![codecov](https://codecov.io/gh/googlemaps/js-api-loader/branch/main/graph/badge.svg)](https://codecov.io/gh/googlemaps/js-api-loader)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n![Contributors](https://img.shields.io/github/contributors/googlemaps/js-api-loader?color=green)\n[![License](https://img.shields.io/github/license/googlemaps/js-api-loader?color=blue)][license]\n[![StackOverflow](https://img.shields.io/stackexchange/stackoverflow/t/google-maps?color=orange\u0026label=google-maps\u0026logo=stackoverflow)](https://stackoverflow.com/questions/tagged/google-maps)\n[![Discord](https://img.shields.io/discord/676948200904589322?color=6A7EC2\u0026logo=discord\u0026logoColor=ffffff)][Discord server]\n\n# Google Maps JavaScript API Loader\n\n## Description\nLoad the Google Maps JavaScript API script dynamically. This takes inspiration from the [google-maps](https://www.npmjs.com/package/google-maps) npm package but updates it with ES6, Promises, and TypeScript.\n\n## Requirements\n\n* [Sign up with Google Maps Platform]\n* A Google Maps Platform [project] with the [**Maps Javascript API**][maps-sdk] enabled\n* An [API key] associated with the project above\n* [@googlemaps/js-api-loader NPM package][npm-pkg]\n\n## Installation\n\nInstall the [@googlemaps/js-api-loader NPM package][npm-pkg] with:\n\n```sh\nnpm i @googlemaps/js-api-loader\n```\n\nAlternatively you may add the umd package directly to the html document using the unpkg link.\n\n```html\n\u003cscript src=\"https://unpkg.com/@googlemaps/js-api-loader@1.x/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\nWhen adding via unpkg, the loader can be accessed at `google.maps.plugins.loader.Loader`.\n\n### TypeScript\n\nTypeScript users need to install the following types package.\n\n```sh\nnpm i -D @types/google.maps\n```\n\n## Documentation\n\nThe reference documentation can be found at this [link](https://googlemaps.github.io/js-api-loader/index.html). The Google Maps JavaScript API [documentation](https://developers.google.com/maps/documentation/javascript/tutorial) is the authoritative source for the loader options.\n\n## Usage\n\n```javascript\nimport { Loader } from '@googlemaps/js-api-loader';\n\nconst loader = new Loader({\n  apiKey: \"\",\n  version: \"weekly\",\n  libraries: [\"places\"]\n});\n\nconst mapOptions = {\n  center: {\n    lat: 0,\n    lng: 0\n  },\n  zoom: 4\n};\n\n```\n\nUsing a promise for a specific library.\n\n```javascript\n// Promise for a specific library\nloader\n  .importLibrary('maps')\n  .then(({Map}) =\u003e {\n    new Map(document.getElementById(\"map\"), mapOptions);\n  })\n  .catch((e) =\u003e {\n    // do something\n  });\n```\n\nUsing a promise for when the script has loaded.\n\n```javascript\n// Promise\nloader\n  .load()\n  .then((google) =\u003e {\n    new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n  })\n  .catch(e =\u003e {\n    // do something\n  });\n```\n\nAlternatively, if you want to use a callback.\n\n```javascript\n// Callback\nloader.loadCallback(e =\u003e {\n  if (e) {\n    console.log(e);\n  } else {\n    new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n  }\n});\n```\n\nView the package in action [here](https://googlemaps.github.io/js-api-loader/examples/index.html).\n\n## Contributing\n\nContributions are welcome and encouraged! If you'd like to contribute, send us a [pull request] and refer to our [code of conduct] and [contributing guide].\n\n## Terms of Service\n\nThis library uses Google Maps Platform services. Use of Google Maps Platform services through this library is subject to the Google Maps Platform [Terms of Service].\n\nThis library is not a Google Maps Platform Core Service. Therefore, the Google Maps Platform Terms of Service (e.g. Technical Support Services, Service Level Agreements, and Deprecation Policy) do not apply to the code in this library.\n\n## Support\n\nThis library is offered via an open source [license]. It is not governed by the Google Maps Platform Support [Technical Support Services Guidelines, the SLA, or the [Deprecation Policy]. However, any Google Maps Platform services used by the library remain subject to the Google Maps Platform Terms of Service.\n\nThis library adheres to [semantic versioning] to indicate when backwards-incompatible changes are introduced. Accordingly, while the library is in version 0.x, backwards-incompatible changes may be introduced at any time.\n\nIf you find a bug, or have a feature request, please [file an issue] on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of our [developer community channels]. If you'd like to contribute, please check the [contributing guide].\n\nYou can also discuss this library on our [Discord server].\n\n[API key]: https://developers.google.com/maps/documentation/javascript/get-api-key\n[maps-sdk]: https://developers.google.com/maps/documentation/javascript\n[documentation]: https://googlemaps.github.io/js-api-loader\n[npm-pkg]: https://npmjs.com/package/@googlemaps/js-api-loader\n\n[code of conduct]: ?tab=coc-ov-file#readme\n[contributing guide]: CONTRIBUTING.md\n[Deprecation Policy]: https://cloud.google.com/maps-platform/terms\n[developer community channels]: https://developers.google.com/maps/developer-community\n[Discord server]: https://discord.gg/hYsWbmk\n[file an issue]: https://github.com/googlemaps/js-api-loader/issues/new/choose\n[license]: LICENSE\n[project]: https://developers.google.com/maps/documentation/javascript/cloud-setup#enabling-apis\n[pull request]: https://github.com/googlemaps/js-api-loader/compare\n[semantic versioning]: https://semver.org\n[Sign up with Google Maps Platform]: https://console.cloud.google.com/google/maps-apis/start\n[similar inquiry]: https://github.com/googlemaps/js-api-loader/issues\n[SLA]: https://cloud.google.com/maps-platform/terms/sla\n[Technical Support Services Guidelines]: https://cloud.google.com/maps-platform/terms/tssg\n[Terms of Service]: https://cloud.google.com/maps-platform/terms\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglemaps%2Fjs-api-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglemaps%2Fjs-api-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglemaps%2Fjs-api-loader/lists"}