<commit_before>var BaseElement = require('base-element')
var inherits = require('inherits')
var L = require('leaflet')
require('mapbox.js')

module.exports = DataMap
inherits(DataMap, BaseElement)

function DataMap (options) {
  if (!(this instanceof DataMap)) return new DataMap(options)
  BaseElement.call(this, options.el)
  var self = this
  options.tiles = options.tiles || 'mapbox.streets'
  this.addEventListener('load', function (node) {
    var mapEl = node.childNodes[0]
    var tiles = options.tiles
    L.mapbox.accessToken = options.accessToken
    options.popupOptions = null
    self.map = L.mapbox.map(mapEl, tiles, options)
    self.geojson = L.mapbox.featureLayer().addTo(self.map)
  })
}

DataMap.prototype.setGeoJSON = function (geojson) {
  this.geojson.setGeoJSON(geojson)
}

DataMap.prototype.render = function (state) {
  if (this.geojson && state.geojson) this.setGeoJSON(state.geojson)
  var vtree = this.html('div#map-container', this, [
    this.html('div#map')
  ])
  return this.afterRender(vtree)
}
<commit_msg>send click event through mapview<commit_after>var BaseElement = require('base-element')
var inherits = require('inherits')
var L = require('leaflet')
require('mapbox.js')

module.exports = DataMap
inherits(DataMap, BaseElement)

function DataMap (options) {
  if (!(this instanceof DataMap)) return new DataMap(options)
  BaseElement.call(this, options.el)
  var self = this
  options.tiles = options.tiles || 'mapbox.streets'
  this.addEventListener('load', function (node) {
    var mapEl = node.childNodes[0]
    var tiles = options.tiles
    L.mapbox.accessToken = options.accessToken
    options.popupOptions = null
    self.map = L.mapbox.map(mapEl, tiles, options)
    self.geojson = L.mapbox.featureLayer().addTo(self.map)
    self.geojson.on('click', function (e) {
      self.send('click:layer', e)
    })
  })
}

DataMap.prototype.setGeoJSON = function (geojson) {
  this.geojson.setGeoJSON(geojson)
}

DataMap.prototype.render = function (state) {
  if (this.geojson && state.geojson) this.setGeoJSON(state.geojson)
  var vtree = this.html('div#map-container', this, [
    this.html('div#map')
  ])
  return this.afterRender(vtree)
}

{'fraction_non_alphanumeric': 0.13893967093235832, 'fraction_numerical': 0.0009140767824497258, 'mean_word_length': 4.431761786600497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3324855', 'n_tokens_mistral': 739, 'n_tokens_neox': 738, 'n_words': 147}