js/iframeResizer.contentWindow.js
function throttle(func) {
    var context,
      args,
      result,
      timeout = null,
      previous = 0,
      later = function() {
        previous = getNow()
        timeout = null
        result = func.apply(context, args)
        if (!timeout) {
          // eslint-disable-next-line no-multi-assign
          context = args = null
        }
      }

    return function() {
      var now = getNow()

      if (!previous) {
        previous = now
      }

      var remaining = throttledTimer - (now - previous)

      context = this
      args = arguments

      if (remaining <= 0 || remaining > throttledTimer) {
        if (timeout) {
          clearTimeout(timeout)
          timeout = null
        }

        previous = now
        result = func.apply(context, args)

        if (!timeout) {
          // eslint-disable-next-line no-multi-assign
          context = args = null
        }
      } else if (!timeout) {
        timeout = setTimeout(later, remaining)
      }

      return result
    }
  }
function throttle(func) {
    var context,
      args,
      result,
      timeout = null,
      previous = 0,
      later = function() {
        previous = getNow()
        timeout = null
        result = func.apply(context, args)
        if (!timeout) {
          // eslint-disable-next-line no-multi-assign
          context = args = null
        }
      }

    return function() {
      var now = getNow()

      if (!previous) {
        previous = now
      }

      var remaining = throttledTimer - (now - previous)

      context = this
      args = arguments

      if (remaining <= 0 || remaining > throttledTimer) {
        if (timeout) {
          clearTimeout(timeout)
          timeout = null
        }

        previous = now
        result = func.apply(context, args)

        if (!timeout) {
          // eslint-disable-next-line no-multi-assign
          context = args = null
        }
      } else if (!timeout) {
        timeout = setTimeout(later, remaining)
      }

      return result
    }
  }
function throttle ( func ) { var context , args , result , timeout = null , previous = 0 , later = function ( ) { previous = getNow ( ) timeout = null result = func . apply ( context , args ) if ( ! timeout ) { // eslint-disable-next-line no-multi-assign context = args = null } } return function ( ) { var now = getNow ( ) if ( ! previous ) { previous = now } var remaining = throttledTimer - ( now - previous ) context = this args = arguments if ( remaining <= 0 || remaining > throttledTimer ) { if ( timeout ) { clearTimeout ( timeout ) timeout = null } previous = now result = func . apply ( context , args ) if ( ! timeout ) { // eslint-disable-next-line no-multi-assign context = args = null } } else if ( ! timeout ) { timeout = setTimeout ( later , remaining ) } return result } }
Based on underscore.js
Based on underscore . js