Click the map to drop a stop on the route; click a stop to remove it. Every event that fires is logged below, newest first.
Evented, so on, once,
off and fire are available on the map, on layers and on
controls alike.
latlng (geographic) and
containerPoint (pixels relative to the map container). Use the first
for data, the second for positioning DOM.
once removes its own listener after the first call — handy for
one-shot setup without bookkeeping.
fire(type, data) emits your own events with any payload. It is the
cleanest way for a plugin to notify an application without coupling to it.
map.on('moveend zoomend', handler).
off matches on the function
reference, so an inline arrow function can never be removed. Keep a reference to
anything you intend to detach later — especially inside a control's
onAdd, where onRemove has to undo it.
import {CargoMap, TileLayer, Marker, Polyline} from 'cargocanvas';