Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-maps-js-api-loader

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-maps-js-api-loader - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

index.cjs

47

package.json

@@ -1,46 +0,1 @@

{
"name": "google-maps-js-api-loader",
"version": "2.2.1",
"description": "Google Maps JavaScript API loader",
"repository": {
"type": "git",
"url": "git+https://github.com/Krombik/google-maps-loader.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/Krombik/google-maps-loader/issues"
},
"homepage": "https://github.com/Krombik/google-maps-loader#readme",
"type": "module",
"source": "src/index.ts",
"exports": {
"require": "./dist/index.cjs",
"default": "./dist/index.modern.js"
},
"main": "./dist/index.cjs",
"module": "./dist/index.module.js",
"types": "./dist/index.d.ts",
"unpkg": "./dist/index.umd.js",
"scripts": {
"build": "microbundle",
"start": "microbundle watch"
},
"devDependencies": {
"@types/google.maps": "^3.50.2",
"microbundle": "^0.15.1",
"typescript": "^4.8.4"
},
"files": [
"dist",
"src"
],
"keywords": [
"google",
"maps",
"asynchronous",
"async",
"loader",
"browser"
]
}
{"name":"google-maps-js-api-loader","version":"2.3.0","author":"","description":"A lightweight JavaScript library for loading the Google Maps JavaScript API","keywords":["google","maps","asynchronous","async","loader","browser"],"repository":{"type":"git","url":"git+https://github.com/Krombik/google-maps-loader.git"},"license":"MIT","bugs":{"url":"https://github.com/Krombik/google-maps-loader/issues"},"homepage":"https://github.com/Krombik/google-maps-loader#readme","engines":{"node":">10"},"publishConfig":{"access":"public"},"main":"./index.cjs","module":"./index.js","types":"./index.d.ts","unpkg":"./index.global.js","sideEffects":false}

@@ -5,3 +5,3 @@ # google-maps-js-api-loader

`Google Maps JavaScript API` loader
Lightweight JavaScript library that simplifies the process of adding `Google Maps JavaScript API` to web application.

@@ -11,5 +11,7 @@ ## Example

```ts
import Loader, { LoaderStatus } from "google-maps-js-api-loader";
import GoogleMapsLoader, {
GoogleMapsLoaderStatus,
} from "google-maps-js-api-loader";
Loader.setOptions({
GoogleMapsLoader.setOptions({
apiKey: API_KEY,

@@ -19,9 +21,10 @@ // ...some other options

const unlisten = Loader.addListener(LoaderStatus.LOADED, () =>
console.log("google.maps is ready")
const unlisten = GoogleMapsLoader.addListener(
GoogleMapsLoaderStatus.LOADED,
() => console.log("google.maps is ready")
);
Loader.completion.then(() => console.log("google.maps is ready"));
GoogleMapsLoader.completion.then(() => console.log("google.maps is ready"));
await Loader.load();
await GoogleMapsLoader.load();
```

@@ -34,3 +37,3 @@

```ts
static setOptions(options: LoaderOptions): void
static setOptions(options: GoogleMapsLoaderOptions): void
```

@@ -40,16 +43,16 @@

| LoaderOptions | Description | |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| apiKey | Your [API key](https://developers.google.com/maps/documentation/javascript/get-api-key). The `Google Maps JavaScript API` will not load unless a valid API key is specified | |
| version? | The [version](https://developers.google.com/maps/documentation/javascript/versions) of the `Google Maps JavaScript API` to use | |
| libraries? | Array of additional `Google Maps JavaScript API` [libraries](https://developers.google.com/maps/documentation/javascript/libraries) to load | |
| language? | The [language](https://developers.google.com/maps/documentation/javascript/localization) to use. This affects the names of controls, copyright notices, driving directions, and control labels, as well as the responses to service requests. See the [list of supported languages](https://developers.google.com/maps/faq#languagesupport) | |
| region? | The [region](https://developers.google.com/maps/documentation/javascript/localization#Region) code to use. This alters the map's behavior based on a given country or territory | |
| authReferrerPolicy? | Maps JS customers can configure HTTP Referrer Restrictions in the Cloud Console to limit which URLs are allowed to use a particular API Key. By default, these restrictions can be configured to allow only certain paths to use an API Key. If any URL on the same domain or origin may use the API Key, you can set `"origin"` to limit the amount of data sent when authorizing requests from the `Google Maps JavaScript API`. This is available starting in version **3.46**. When this parameter is specified and HTTP Referrer Restrictions are enabled on Cloud Console, `Google Maps JavaScript API` will only be able to load if there is an HTTP Referrer Restriction that matches the current website's domain without a path specified | |
| url? | Use a custom url and path to load the Google Maps API script | |
| nonce? | Adds [nonce attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-nonce) to the script | |
| async? | Adds [async attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async) to the script | |
| defer? | Adds [defer attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-defer) to the script | |
| retryCount? | Number of retries if script loading fails | `2` |
| retryDelay? | Delay between retries | `2000` |
| GoogleMapsLoaderOptions | Description | |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| apiKey | Your [API key](https://developers.google.com/maps/documentation/javascript/get-api-key) | |
| version? | The [version](https://developers.google.com/maps/documentation/javascript/versions) of the `Google Maps JavaScript API` to use | |
| libraries? | Array of additional `Google Maps JavaScript API` [libraries](https://developers.google.com/maps/documentation/javascript/libraries) to load | |
| language? | The [language](https://developers.google.com/maps/documentation/javascript/localization) to use. This affects the names of controls, copyright notices, driving directions, and control labels, as well as the responses to service requests. See the [list of supported languages](https://developers.google.com/maps/faq#languagesupport) | |
| region? | The [region](https://developers.google.com/maps/documentation/javascript/localization#Region) code to use. This alters the map's behavior based on a given country or territory | |
| authReferrerPolicy? | Maps JS customers can configure HTTP Referrer Restrictions in the Cloud Console to limit which URLs are allowed to use a particular API Key. By default, these restrictions can be configured to allow only certain paths to use an API Key. If any URL on the same domain or origin may use the API Key, you can set `"origin"` to limit the amount of data sent when authorizing requests from the `Google Maps JavaScript API`. This is available starting in version **3.46**. When this parameter is specified and HTTP Referrer Restrictions are enabled on Cloud Console, `Google Maps JavaScript API` will only be able to load if there is an HTTP Referrer Restriction that matches the current website's domain without a path specified | |
| url? | Use a custom url and path to load the Google Maps API script | |
| nonce? | Adds [nonce attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-nonce) to the script | |
| async? | Adds [async attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async) to the script | |
| defer? | Adds [defer attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-defer) to the script | |
| retryCount? | Number of retries if script loading fails | `2` |
| retryDelay? | Delay between retries | `2000` |

@@ -66,3 +69,3 @@ ---

Returns ‎[completion](#completion)
Returns [completion](#completion)

@@ -74,3 +77,3 @@ ---

```ts
enum LoaderStatus {
enum GoogleMapsLoaderStatus {
NONE, // default value

@@ -82,6 +85,6 @@ LOADING,

static status: LoaderStatus
static status: GoogleMapsLoaderStatus
```
Current status of `Loader`
Current status of `GoogleMapsLoader`

@@ -111,4 +114,10 @@ ---

```ts
static addListener(status: LoaderStatus.LOADING | LoaderStatus.LOADED, callback: () => void): () => void;
static addListener(status: LoaderStatus.ERROR, callback: OnError): () => void;
static addListener(
status: GoogleMapsLoaderStatus.LOADING | GoogleMapsLoaderStatus.LOADED,
callback: () => void
): () => void;
static addListener(
status: GoogleMapsLoaderStatus.ERROR,
callback: (err: ErrorEvent | Error) => void
): () => void;
```

@@ -115,0 +124,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc