Source: bemap-leaflet/bemap-map-leaflet-polyline.js

/**
 * Add a bemap.Polyline to the layer
 * @public
 * @param {bemap.Polyline} bemap.Polyline.
 * @param {object} options
 * @return {bemap.LeafletMap}
 */
bemap.LeafletMap.prototype.addPolyline = function(polyline, options) {
  if (polyline !== null && bemap.inheritsof(polyline, bemap.Polyline)) {
    var style = polyline.getStyle();
    var color = style.getColor();

    polyline.native = L.polyline(polyline.getLatLonArrays(), {
      color: color.getHex(),
      opacity: color.getAlpha(),
      weight: style.getWidth(),
      bubblingMouseEvents: false,
      dashArray: style.type === "dash" ? "10":""
    });

    if (polyline.map === null) {
      polyline.map = this;
    }

    var opts = options || {};
    var l = null;

    if (opts.layer !== undefined && (bemap.inheritsof(opts.layer, bemap.VectorLayer))) {
      l = opts.layer;
    } else {
      l = this.getLayerByName(bemap.Map.DEFAULT_LAYER.POLYLINE);
      if (l === null) {
        l = new bemap.VectorLayer({
          name: bemap.Map.DEFAULT_LAYER.POLYLINE
        });
        this.addLayer(l);
      }
    }

    if (polyline.layer === null) {
      polyline.layer = l;
    }
    polyline.native.addTo(l.native);
  }

  return this;
};

/**
 * Remove a polyline from his layer.
 * @public
 * @param {bemap.Polyline} polyline the polyline object to remove.
 */
bemap.LeafletMap.prototype.removePolyline = function(polyline) {
  if (polyline !== null && polyline.layer !== null && polyline.layer.native !== null && bemap.inheritsof(polyline, bemap.Polyline)) {
    polyline.map.native.removeLayer(polyline.native);
    polyline.layer = null;
    polyline.map = null;
  }
  return this;
};

/**
 * Set the listner when an specified eventType occur on bemap.Polyline.
 * @public
 * @param {bemap.Polyline} polyline
 * @param {bemap.Map.EventType} eventType Event type.
 * @param {function} callback Function will be called when the specified eventType is occur.
 * @param {object} options options.
 * @return {bemap.Listener} this.
 */
bemap.LeafletMap.prototype.onPolyline = function(polyline, eventType, callback, options) {
  var opts = options ? options : {};

  var nativeListener = polyline.native.on(eventType, function(evt) {
    var mapEvent = new bemap.MapEvent({
      native: evt,
      bemapObject: polyline,
      x: evt.containerPoint ? evt.containerPoint.x : undefined,
      y: evt.containerPoint ? evt.containerPoint.y : undefined,
      coordinate: evt.latlng ? new bemap.Coordinate(evt.latlng.lng, evt.latlng.lat) : undefined,
      properties: options,
      map: this
    });
    callback(mapEvent);
  });
  var listener = new bemap.Listener({
    native: nativeListener,
    callback: callback,
    key: eventType,
    bemapObject: polyline
  });

  return listener;
};