I'm looking inside LeafletJs source code and I cannot find where L is defined nor exported. L is referred many times and main functions are called against it.
So where is L defined ? What is its nature (object, prototype) ?
A little bit of context : I'm trying to use leaflet with reasonml so I need bucklescript bindings to leaflet and for that I must understand how leaflet is designed. I'm aware of bs-leaflet library but it hasn't show any activity in 2 years.
Leaflet's source code have classes/prototypes/objects.
There's no L though. If you look at leaflet's src code, It's exported default
. Not by name.
The reason why we type in our code something like this:
import L from 'Leaflet'
is because it's a common approach to name that L. That's what Leaflet recommends and states in their docs.
Edit:
Look into node_modules/leaflet/Leaflet.js
. Everything gets imported without names, so when you import L
, it has Map, geometry and other objects already in it.