<commit_before>import EventEmitter from 'events'

export default () => {
  const emitter = new EventEmitter()

  const buffer = {}

  return {
    scatterer: {
      unmount: componentName => {
        emitter.emit(`unmount:${componentName}`)
      },

      render: (componentName, data, handlerNames, context) => {
        emitter.emit(`render:${componentName}`, data, handlerNames, context)
        buffer[`render:${componentName}`] = [data, handlerNames, context]
      },

      addHandlerListener: (componentName, handlerName, cb) => {
        const eventName = `handle:${componentName}:${handlerName}`
        emitter.on(eventName, cb)
        return () => emitter.removeListener(eventName, cb)
      },
    },

    materializer: {
      addUnmountListener: (componentName, cb) => {
        const eventName = `unmount:${componentName}`
        emitter.on(eventName, cb)
        return () => emitter.removeListener(eventName, cb)
      },

      addRenderListener: (componentName, cb) => {
        const eventName = `render:${componentName}`
        emitter.on(eventName, cb)
        if (buffer[`render:${componentName}`]) {
          cb(...buffer[`render:${componentName}`]) // eslint-disable-line standard/no-callback-literal
        }
        return () => emitter.removeListener(eventName, cb)
      },
<commit_msg>Rename buffer > renderBuffer<commit_after>import EventEmitter from 'events'

export default () => {
  const emitter = new EventEmitter()

  const renderBuffer = {}

  return {
    scatterer: {
      unmount: componentName => {
        emitter.emit(`unmount:${componentName}`)
      },

      render: (componentName, data, handlerNames, context) => {
        emitter.emit(`render:${componentName}`, data, handlerNames, context)
        renderBuffer[`render:${componentName}`] = [data, handlerNames, context]
      },

      addHandlerListener: (componentName, handlerName, cb) => {
        const eventName = `handle:${componentName}:${handlerName}`
        emitter.on(eventName, cb)
        return () => emitter.removeListener(eventName, cb)
      },
    },

    materializer: {
      addUnmountListener: (componentName, cb) => {
        const eventName = `unmount:${componentName}`
        emitter.on(eventName, cb)
        return () => emitter.removeListener(eventName, cb)
      },

      addRenderListener: (componentName, cb) => {
        const eventName = `render:${componentName}`
        emitter.on(eventName, cb)
        if (renderBuffer[`render:${componentName}`]) {
          cb(...renderBuffer[`render:${componentName}`]) // eslint-disable-line standard/no-callback-literal
        }
        return () => emitter.removeListener(eventName, cb)
      },

{'fraction_non_alphanumeric': 0.145515444733904, 'fraction_numerical': 0.0, 'mean_word_length': 3.011940298507463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '4422483', 'n_tokens_mistral': 776, 'n_tokens_neox': 763, 'n_words': 142}