File

packages/core/src/lib/services/maps-api-loader/noop-maps-api-loader.ts

Description

When using the NoOpMapsAPILoader, the Google Maps API must be added to the page via a <script> Tag. It's important that the Google Maps API script gets loaded first on the page.

Implements

MapsAPILoader

Index

Methods

Methods

load
load()
Returns : Promise<void>
import { MapsAPILoader } from './maps-api-loader';

/**
 * When using the NoOpMapsAPILoader, the Google Maps API must be added to the page via a `<script>`
 * Tag.
 * It's important that the Google Maps API script gets loaded first on the page.
 */
export class NoOpMapsAPILoader implements MapsAPILoader {
  load(): Promise<void> {
    if (!(window as any).google || !(window as any).google.maps) {
      throw new Error(
          'Google Maps API not loaded on page. Make sure window.google.maps is available!');
    }
    return Promise.resolve();
  }
}

result-matching ""

    No results matching ""