@p803/google-maps-apideprecated

Google Maps API for JavaScript

Usage no npm install needed!

<script type="module">
  import p803GoogleMapsApi from 'https://cdn.skypack.dev/@p803/google-maps-api';
</script>

README

Google Maps API for JavaScript

This repository contains a JavaScript package that allows you to access the Google Maps JavaScript API from your JavaScript project.

Installation

This package can be installed with npm. Run this command:

npm install @p803/google-maps-api

or use the standalone format:

<script src="https://unpkg.com/@p803/google-maps-api"></script>

Usage

Simple example of creating an autocomplete object.

// Import the package.
import googleMapsApi from '@p803/google-maps-api'  // node
// const googleMapsApi = window.p803.googleMapsApi // browser

// Set api parameters.
googleMapsApi.params = {
    key: '{google-maps-api-key}',      // required
    libraries: ['places', 'geometry'], // optional
    // other params...
}

// Grab the api.
const api = await googleMapsApi()

// Create autocomplete object.
const autocomplete = new api.places.Autocomplete(/** params */);