<commit_before>
# remove for junction.debounce once stable
class Debounce

  constructor: (@data) ->
    window.requestAnimationFrame = window.requestAnimationFrame or
      window.webkitRequestAnimationFrame or
      window.mozRequestAnimationFrame;

    @.callback = @data
    @.ticking = false

  update: =>
    @.callback and @.callback()
    @.ticking = false

  requestTick: =>
    unless @.ticking
      requestAnimationFrame(this.rafCallback or (
        this.rafCallback = this.update.bind(this)
      ))
      @.ticking = true

  handleEvent: =>
    @.requestTick()



Meteor.startup ->

  # set up var and dependency for tracking
  currentSize = ""
  currentHeight = ""
  currentSizeDep = new Tracker.Dependency
  stylesApplied = []

  # comparator function
  test = (size) ->
    currentSizeDep.depend()
    return currentSize.match size

  testHeight = (size) ->
    currentSizeDep.depend()
    return currentHeight.match size

  # lock Dom events in nonreactive so we never rebind events
  Tracker.nonreactive ->

    # create marker element
    marker = document.createElement("DIV")
    marker.className = "media-query"

    heightMarker = document.createElement("DIV")
    heightMarker.className = "media-query-height"

    # hide it
    marker.style.display = "none !important"
    heightMarker.style.display = "none !important"

    # add it to the Dom
    document.body.appendChild marker
    document.body.appendChild heightMarker

    # update size on resize event
    getSize = ->
      trackingElement = document.getElementsByClassName("media-query")[0]
      heightTrackingElement = document.getElementsByClassName("media-query-height")[0]

      if window.getComputedStyle

        currentSize = window.getComputedStyle(
          trackingElement, ":before" # no pseudo support in IE 9, 10 :(
        ).getPropertyValue("content")

        currentHeight = window.getComputedStyle(
          heightTrackingElement, ":before" # no pseudo support in IE 9, 10 :(<commit_msg>Ensure media query width gets calculated<commit_after>
# remove for junction.debounce once stable
class Debounce

  constructor: (@data) ->
    window.requestAnimationFrame = window.requestAnimationFrame or
      window.webkitRequestAnimationFrame or
      window.mozRequestAnimationFrame;

    @.callback = @data
    @.ticking = false

  update: =>
    @.callback and @.callback()
    @.ticking = false

  requestTick: =>
    unless @.ticking
      requestAnimationFrame(this.rafCallback or (
        this.rafCallback = this.update.bind(this)
      ))
      @.ticking = true

  handleEvent: =>
    @.requestTick()



Meteor.startup ->

  # set up var and dependency for tracking
  currentSize = ""
  currentHeight = ""
  currentSizeDep = new Tracker.Dependency
  stylesApplied = []

  # comparator function
  test = (size) ->
    currentSizeDep.depend()
    return currentSize.match size

  testHeight = (size) ->
    currentSizeDep.depend()
    return currentHeight.match size

  # lock Dom events in nonreactive so we never rebind events
  Tracker.nonreactive ->

    # create marker element
    marker = document.createElement("DIV")
    marker.className = "media-query"

    heightMarker = document.createElement("DIV")
    heightMarker.className = "media-query-height"

    # hide it
    marker.style.display = "none !important"
    heightMarker.style.display = "none !important"

    # add it to the Dom
    document.body.appendChild marker
    document.body.appendChild heightMarker

    # update size on resize event
    getSize = ->
      trackingElement = document.getElementsByClassName("media-query")[0]
      heightTrackingElement = document.getElementsByClassName("media-query-height")[0]

      if window.getComputedStyle

        loop
          currentSize = window.getComputedStyle(
            trackingElement, ":before" # no pseudo support in IE 9, 10 :(
          ).getPropertyValue("content")
          break if currentSize

        currentHeight = window.getComputedStyle(
          heightTrackingElement, ":before" # no pseudo support in IE 9, 10 :(
{'fraction_non_alphanumeric': 0.09535512410911771, 'fraction_numerical': 0.00393217006635537, 'mean_word_length': 3.053784860557769, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 21, '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': '3300342', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1082, 'n_words': 287}