In my previous Leftlet post, I gave an example that showed that shapes and click events were preserved across the Cloudmade and OSM map tiles, but not for Google. Before I go off and try writing my own Leaflet plugin for Google I must first learn the Leaflet API. For me, that starts with class diagrams since I am a visual learner.
L is the namespace for all Leaflet classes, not to be confused with the character “L” from Death Note.
L is shown in the class diagram with only a few of its many functions. The functions shown are all assigned from L.Util.
L.Util contains core utility functions used throughout Leaflet. The code snippet below shows L.Util function assignments to L. Instead of calling L.Util.extend(), for instance, you can call L.extend().
L.extend is, in turn, used in functions of L.Class.
L.Class is the base class used for object oriented design in Leaflet. In my next post, we’ll start looking at Leaflet’s object classes, all of which extend from L.Class.
Finally, the Leaflet event model is based on L.Mixin. L.Mixin is included in L.Draggable, L.FeatureGroup, L.ImageOverlay, L.Map, L.Marker, L.Path, L.Popup, L.PosAnnimation, and L.TileLayer, all of which I’ll explore my the next few posts.