UNPKG

2.98 kBTypeScriptView Raw
1import { InjectionToken } from '@angular/core';
2import { DocumentRef, WindowRef } from '../../utils/browser-globals';
3import { MapsAPILoader } from './maps-api-loader';
4export declare enum GoogleMapsScriptProtocol {
5 HTTP = 1,
6 HTTPS = 2,
7 AUTO = 3
8}
9/**
10 * Token for the config of the LazyMapsAPILoader. Please provide an object of type {@link
11 * LazyMapsAPILoaderConfig}.
12 */
13export declare const LAZY_MAPS_API_CONFIG: InjectionToken<LazyMapsAPILoaderConfigLiteral>;
14/**
15 * Configuration for the {@link LazyMapsAPILoader}.
16 */
17export interface LazyMapsAPILoaderConfigLiteral {
18 /**
19 * The Google Maps API Key (see:
20 * https://developers.google.com/maps/documentation/javascript/get-api-key)
21 */
22 apiKey?: string;
23 /**
24 * The Google Maps client ID (for premium plans).
25 * When you have a Google Maps APIs Premium Plan license, you must authenticate
26 * your application with either an API key or a client ID.
27 * The Google Maps API will fail to load if both a client ID and an API key are included.
28 */
29 clientId?: string;
30 /**
31 * The Google Maps channel name (for premium plans).
32 * A channel parameter is an optional parameter that allows you to track usage under your client
33 * ID by assigning a distinct channel to each of your applications.
34 */
35 channel?: string;
36 /**
37 * Google Maps API version.
38 */
39 apiVersion?: string;
40 /**
41 * Host and Path used for the `<script>` tag.
42 */
43 hostAndPath?: string;
44 /**
45 * Protocol used for the `<script>` tag.
46 */
47 protocol?: GoogleMapsScriptProtocol;
48 /**
49 * Defines which Google Maps libraries should get loaded.
50 */
51 libraries?: string[];
52 /**
53 * The default bias for the map behavior is US.
54 * If you wish to alter your application to serve different map tiles or bias the
55 * application, you can overwrite the default behavior (US) by defining a `region`.
56 * See https://developers.google.com/maps/documentation/javascript/basics#Region
57 */
58 region?: string;
59 /**
60 * The Google Maps API uses the browser's preferred language when displaying
61 * textual information. If you wish to overwrite this behavior and force the API
62 * to use a given language, you can use this setting.
63 * See https://developers.google.com/maps/documentation/javascript/basics#Language
64 */
65 language?: string;
66}
67export declare class LazyMapsAPILoader extends MapsAPILoader {
68 private localeId;
69 protected _scriptLoadingPromise: Promise<void>;
70 protected _config: LazyMapsAPILoaderConfigLiteral;
71 protected _windowRef: WindowRef;
72 protected _documentRef: DocumentRef;
73 protected readonly _SCRIPT_ID: string;
74 protected readonly callbackName: string;
75 constructor(config: any, w: WindowRef, d: DocumentRef, localeId: string);
76 load(): Promise<void>;
77 private _assignScriptLoadingPromise;
78 protected _getScriptSrc(callbackName: string): string;
79}