create-google-maps

Library for declarative creation of Google Maps

Usage no npm install needed!

<script type="module">
  import createGoogleMaps from 'https://cdn.skypack.dev/create-google-maps';
</script>

README

Create Google Maps

Library for declarative creation of Google Maps

Work in progress. The API can be changed. You use it at your own risk.

API

Soon. If you want to use this library now, have a look at the code. It is not complicated

createMarker

createMarker: (config: MarkerOptions) => Marker

config contains defaults marker options without map property because is is passed by class. Returns instance of Marker

removeMarkers

removeMarkers: () => void

Removes all markers from the map

removeMarker

removeMarker: (marker: Marker) => void

Removes passed marker from map.

fitBounds

fitBounds: (bounds?: MapLatLngBounds, padding?: MapPadding) => void

Sets the viewport to contain the given bounds. If the bounds argument is falsy, the bounds will fit to current markers' position.

removeBounds

removeBounds: (options: {
    center?: MapOptions['center']
    zoom?: MapOptions['zoom']
} = {}) => void

Remove bounds and set default center position and zoom from default options or params passed in options argument.

createInfoWindow

createInfoWindow: (marker: Marker, options: InfoWindowOptions) => void

Creates an info window with the given options.

removeInfoWindow

removeInfoWindow: (marker: Marker) => void

Removes info window from marker passed as argument