<commit_before>import { stringify } from '../util'

export function initEventsBackend (vue, bridge, getInstanceName) {
  let recording = true

  bridge.on('events:toggle-recording', enabled => {
    recording = enabled
  })

  const vueEmit = vue.prototype.$emit
  vue.prototype.$emit = function () {
    vueEmit.apply(this, arguments)

    if (!recording) return
    const eventName = arguments[0]
    if (!eventName.startsWith('hook:')) {
      bridge.send('event:emit', stringify({
        instanceId: this._uid,
        instanceName: getInstanceName(this),
        eventName: eventName,
        eventData: arguments[1],
        timestamp: Date.now()
      }))
    }
  }
}<commit_msg>minor tweak<commit_after>import { stringify } from '../util'

export function initEventsBackend (Vue, bridge, getInstanceName) {
  let recording = true

  bridge.on('events:toggle-recording', enabled => {
    recording = enabled
  })

  const vueEmit = Vue.prototype.$emit
  Vue.prototype.$emit = function () {
    vueEmit.apply(this, arguments)

    if (!recording) return
    const eventName = arguments[0]
    if (!eventName.startsWith('hook:')) {
      bridge.send('event:emit', stringify({
        instanceId: this._uid,
        instanceName: getInstanceName(this),
        eventName: eventName,
        eventData: arguments[1],
        timestamp: Date.now()
      }))
    }
  }
}
{'fraction_non_alphanumeric': 0.1326530612244898, 'fraction_numerical': 0.0029154518950437317, 'mean_word_length': 3.0863095238095237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4401556', 'n_tokens_mistral': 417, 'n_tokens_neox': 412, 'n_words': 89}