0.0.5 • Published 3 years ago

google-maps-svelte v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Documentation

This library is use to render google maps in svelte application. We will have to pass 'latLong' as an input to display google maps in our application. in case we want to add markers of our map neary by locations we will have to pass markers data as per the below defined format. when user click on any particular marker an event will execute and user will notify on which marker user has been clicked

Installation

import google maps javacript in our publish/index.html file

<script src="https://maps.googleapis.com/maps/api/js?key=googleapikey&**callback=initMap"></script>
npm install google-maps-svelte
import GoogleMaps from "google-maps-svelte";

in component html we can use

<GoogleMaps bind:latLong bind:markers on:markerClicked={markerClicked}/>

latLong config format

latLong = {
    lat: 'your latitide',
    long: 'your longitude'
  };

markers config format

markers = [
    {
      lat: 'marker latitude',
      long: 'marker longitude',
      labelDetails: {
        text: 'Marker Text display on marker this is required',
        fontWeight: 'normal',
        fontSize: '12px',
        color: 'white'
      }
    }
  ];

Inputs

InputTypeRequired/OptionalUses
latLongobjectrequiredWe will pass lat/long to display map of that particular area
markersarrayoptionalWe will pass as an array in case we want to display nearby by markers in that particular map

Events

OutputUses
markerClickedThis emitter will trigger when user click on any particular marker and return that particular marker information