Constructor
new GatheringMapController()
Example
<div data-controller="gathering-map"
data-gathering-map-location-value="123 Main St, City, State"
data-gathering-map-gathering-name-value="Great Western War">
<div data-gathering-map-target="map"></div>
</div>
Methods
connect()
- Description:
Connect function - runs when controller connects to DOM
- Source:
(async) createMarker(location)
- Description:
Create marker on the map
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
location |
Object | Google Maps LatLng or {lat, lng} object |
disconnect()
- Description:
Cleanup when controller disconnects
- Source:
(async) geocodeAndDisplayGoogle()
- Description:
Geocode location and display on Google Maps with AdvancedMarkerElement Uses stored lat/lng if available to avoid geocoding API call
- Source:
getDirections()
- Description:
Get directions to location in Google Maps Uses stored lat/lng if available for precise destination, otherwise uses address string
- Source:
(async) initGoogleMap()
- Description:
Initialize Google Maps
- Source:
initialize()
- Description:
Initialize the controller
- Source:
loadGoogleMapsScript()
- Description:
Load Google Maps Script dynamically with marker library Memoized to prevent concurrent script injections and share a single Promise
- Source:
openInAppleMaps()
- Description:
Open location in Apple Maps (works on supported devices) Uses stored lat/lng if available for precise location, otherwise uses address string
- Source:
openInGoogleMaps()
- Description:
Open location in Google Maps (new window/tab) Uses stored lat/lng if available for precise location, otherwise uses address string
- Source:
showError()
- Description:
Show error message
- Source: