Optional method. Called on map.addLayer(layer), before the layer is added to the map, before events are initialized,
without waiting until the map is in a usable state. Use for early initialization only.
Binds a popup to the layer with the passed content and sets up the necessary event listeners.
If a Function is passed it will receive the layer as the first argument and should return a String or HTMLElement
Binds a tooltip to the layer with the passed content and sets up the options>options?) necessary event listeners.
If a Function is passed it will receive the layer as the first argument and should return a String or HTMLElement.
Fires an event of the specified type. You can optionally provide an
data object — the first argument of the listener function will
contain its properties. The event can optionally be propagated to
event parents.
Removes a previously added listener function. If no function is
specified, it will remove all the listeners of that particular event
from the object. Note that if you passed a custom context to on, you
must pass the same context to off in order to remove the listener.
Adds a listener function (fn) to a particular event type of the
object. You can optionally specify the context of the listener
(object the this keyword will point to). You can also pass several
space-separated types (e.g. 'click dblclick').
Should contain code that creates DOM elements for the layer, adds them to map panes where they should belong and puts
listeners on relevant map events. Called on map.addLayer(layer).
Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added
in onAdd. Called on map.removeLayer(layer).