       return
 
     if times > 1 and (!jqXHR.statusCodes or $.inArray(input.status, jqXHR.statusCodes) > -1)
+      $(window).trigger(events.AJAX_RETRY, input)
+
       # implement Retry-After rfc
       # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37
       if retryAfter

events =
  RETRY: 'ajaxRetry.vtex'
  FAIL_RETRY: 'failAjaxRetry.vtex'

$.ajaxPrefilter (options, originalOptions, jqXHR) ->
  jqXHR.retry = (opts) ->

    # whenever we do make this request, pipe its output to our deferred

    nextRequest = ->
      $.ajax(ajaxOptions).retry(
        times: times - 1
        timeout: opts.timeout
