<commit_before>import React from 'react'
import Swipeable from 'react-swipeable'
import ScreenFull from 'screenfull'

const MIN_INTERVAL = 500

function throttle(func, wait) {
  let context, args, result
  let timeout = null
  let previous = 0

  let later = function() {
    previous = new Date().getTime()
    timeout = null
    result = func.apply(context, args)
    if (!timeout) context = args = null
  }
  return function() {
    let now = new Date().getTime()
    let remaining = wait - (now - previous)
    context = this
    args = arguments
    if (remaining <= 0 || remaining > wait) {
      if (timeout) {
        clearTimeout(timeout)
        timeout = null
      }
      previous = now
      result = func.apply(context, args)
      if (!timeout) context = args = null
    } else if (!timeout) {
      timeout = setTimeout(later, remaining)
    }
    return result
  }
}

// This is to handle accessing event properties in an asynchronous way
// https://facebook.github.io/react/docs/events.html#syntheticevent
function debounceEventHandler(...args) {
  const throttled = throttle(...args)
  return function(event) {
    event.persist()
    return throttled(event)
  }<commit_msg>Fixes missing event on debounceEventHandler<commit_after>import React from 'react'
import Swipeable from 'react-swipeable'
import ScreenFull from 'screenfull'

const MIN_INTERVAL = 500

function throttle(func, wait) {
  let context, args, result
  let timeout = null
  let previous = 0

  let later = function() {
    previous = new Date().getTime()
    timeout = null
    result = func.apply(context, args)
    if (!timeout) context = args = null
  }
  return function() {
    let now = new Date().getTime()
    let remaining = wait - (now - previous)
    context = this
    args = arguments
    if (remaining <= 0 || remaining > wait) {
      if (timeout) {
        clearTimeout(timeout)
        timeout = null
      }
      previous = now
      result = func.apply(context, args)
      if (!timeout) context = args = null
    } else if (!timeout) {
      timeout = setTimeout(later, remaining)
    }
    return result
  }
}

// This is to handle accessing event properties in an asynchronous way
// https://facebook.github.io/react/docs/events.html#syntheticevent
function debounceEventHandler(...args) {
  const throttled = throttle(...args)
  return function(event) {
    if (event) {
      event.persist()
      return throttled(event)
    }

    return throttled()
  }
{'fraction_non_alphanumeric': 0.10773592547590118, 'fraction_numerical': 0.004050222762251924, 'mean_word_length': 2.8354037267080745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '3058673', 'n_tokens_mistral': 742, 'n_tokens_neox': 709, 'n_words': 226}