<commit_before>import socketIO from 'socket.io-client'
import Emitter from 'weakee'
import cloneDeep from 'lodash.clonedeep'

class JspmHotReloader extends Emitter {
  constructor (backendUrl) {
    super()
    this.socket = socketIO(backendUrl)
    this.socket.on('connect', () => {
      console.log('hot reload connected to watcher on ', backendUrl)
    })
    this.socket.on('change', (moduleName) => {
      this.emit('change', moduleName)
      if (moduleName === 'index.html') {
        document.location.reload(true)
      } else {
        this.hotReload(moduleName)
      }
    })
    this.pushImporters(System.loads)
  }
  pushImporters (moduleMap, overwriteOlds) {
    Object.keys(moduleMap).forEach((moduleName) => {
      let mod = System.loads[moduleName]
      if (!mod.importers) {
        mod.importers = []
      }
      mod.deps.forEach((dependantName) => {
        let normalizedDependantName = mod.depMap[dependantName]
        let dependantMod = System.loads[normalizedDependantName]<commit_msg>emitting identification when connected to backend<commit_after>import socketIO from 'socket.io-client'
import Emitter from 'weakee'
import cloneDeep from 'lodash.clonedeep'

class JspmHotReloader extends Emitter {
  constructor (backendUrl) {
    super()
    this.socket = socketIO(backendUrl)
    this.socket.on('connect', () => {
      console.log('hot reload connected to watcher on ', backendUrl)
      this.socket.emit('identification', navigator.userAgent)
    })
    this.socket.on('change', (moduleName) => {
      this.emit('change', moduleName)
      if (moduleName === 'index.html') {
        document.location.reload(true)
      } else {
        this.hotReload(moduleName)
      }
    })
    this.pushImporters(System.loads)
  }
  pushImporters (moduleMap, overwriteOlds) {
    Object.keys(moduleMap).forEach((moduleName) => {
      let mod = System.loads[moduleName]
      if (!mod.importers) {
        mod.importers = []
      }
      mod.deps.forEach((dependantName) => {
        let normalizedDependantName = mod.depMap[dependantName]
        let dependantMod = System.loads[normalizedDependantName]
{'fraction_non_alphanumeric': 0.12382739212007504, 'fraction_numerical': 0.0, 'mean_word_length': 3.2405566600397613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3265332', 'n_tokens_mistral': 663, 'n_tokens_neox': 653, 'n_words': 120}