Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
load-google-maps-api
Advanced tools
A thin, Promise-returning helper for loading the Google Maps JavaScript API.
A thin, Promise-returning helper for loading the Google Maps JavaScript API.
const loadGoogleMapsAPI = require('load-google-maps-api')
loadGoogleMapsAPI().then(function(googleMaps) {
console.log(googleMaps) //=> Object { Animation: Object, ...
}).catch((err) => {
console.error(err)
})
Read the source to understand how this works.
N.B. Just like the Google Maps API itself, this module is client-side only.
Without this module, you would need to specify a named global callback, and pass said callback’s name as a parameter in the script
tag’s src
. For example:
<script>
window.googleMapsOnLoad = () => {
// `google.maps` available here
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?callback=googleMapsOnLoad"></script>
This module abstracts this ceremony away, and fits better with Browserify or Webpack.
const loadGoogleMapsAPI = require('load-google-maps-api')
Returns a Promise. (See Usage.)
google.maps
object.options.timeout
.options
is an optional object literal:
Key | Description | Default |
---|---|---|
client | Client ID | undefined |
key | Your API key | undefined |
language | Language | undefined |
libraries | Supplemental libraries to load | [] |
region | Region | undefined |
timeout | Time in milliseconds before rejecting the promise | 10000 |
v | API version | undefined |
Install via yarn:
$ yarn add load-google-maps-api
Or npm:
$ npm install --save load-google-maps-api
FAQs
A lightweight Promise-returning helper for loading the Google Maps JavaScript API
The npm package load-google-maps-api receives a total of 29,009 weekly downloads. As such, load-google-maps-api popularity was classified as popular.
We found that load-google-maps-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.