leaflet layer control events?
There are some events that let you know when the user activates / desactivates a layer.
This may help you:
https://leafletjs.com/reference-1.4.0.html#map-baselayerchange
For example:
map.on('overlayadd', onOverlayAdd);
function onOverlayAdd(e){
//do whatever
}
There is a "baselayerchange' event defined here http://leafletjs.com/reference.html#control-layers Just bind it to the map object and you are good to go.
map.on('baselayerchange', function(e) {
console.log(e);
});