 
 
 # Typesets the entire document
-TypesetDocument = ->
+typesetDocument = ->
 
   nodes = document.querySelectorAll(MATH_SELECTOR)
   return if _.isEmpty(nodes)


# Install a debounce around typesetting function so that it will only run once
# every 10ms even if called multiple calls times in that period
TypesetDocument = _.debounce( TypesetDocument, 10)


typesetMath = (root) ->

  # render MathML with MathJax
  window.MathJax.Hub.Queue(['Typeset', MathJax.Hub, root]) if hasMath

  typesetDocument()



