UNPKG

nuxt-mapbox

Version:

Elegant Mapbox GL JS integration with Nuxt

15 lines (14 loc) 374 B
import { watch } from "#imports"; import { useMapboxMarkerRef } from "./mapboxMarkerRef.js"; export function useMapboxMarker(markerID, callback) { const marker = useMapboxMarkerRef(markerID); if (!marker.value) { watch(() => marker.value, () => { if (marker.value) { callback(marker.value); } }); } else { callback(marker.value); } }