Skip to content

Store a leaflet map instance on a DOM element so other plugins can write on the same map#53

Open
etjones wants to merge 1 commit into
simonw:mainfrom
etjones:store_map_handle
Open

Store a leaflet map instance on a DOM element so other plugins can write on the same map#53
etjones wants to merge 1 commit into
simonw:mainfrom
etjones:store_map_handle

Conversation

@etjones

@etjones etjones commented May 27, 2025

Copy link
Copy Markdown

On map creation, store the leaflet map instance on the DOM element .leaflet-container as datasetteClusterMap. Another plugin can then use that instance to write to the same map, getting the benefits of datasette-cluster-map's logic without.

Another plugin can then do

const mapDiv = document.querySelector(".leaflet-container");
if (mapDiv){
    const map =  mapDiv.datasetteClusterMap;`
}

I guess that this allows plugins to the datasette-cluster-map plugin. Yo dawg...

Includes a sanity-check test to verify that the handle is available

…'.leaflet-container' DOM element. Other plugins can then access this handle and add to the map as needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant