Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
import loadGoogleMapsAPI from 'load-google-maps-api';
loadGoogleMapsAPI().then((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.
import loadGoogleMapsAPI from '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 npm:
$ npm install --save load-google-maps-api
0.0.3
region
optionFAQs
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.