@@ -67,6 +67,9 @@ defaultOptions =
6767 # Should we track web socket connections?
6868 trackWebSockets : false
6969
70+ # A list of regular expressions or substrings of URLS we should ignore (for both tracking and restarting)
71+ ignoreURLs : []
72+
7073now = ->
7174 performance ? .now ? () ? + new Date
7275
@@ -362,12 +365,26 @@ getIntercept = ->
362365 _intercept = new RequestIntercept
363366 _intercept
364367
368+ shouldIgnoreURL = (url ) ->
369+ for pattern in options .ajax .ignoreURLs
370+ if typeof pattern is ' string'
371+ if url .indexOf (pattern) isnt - 1
372+ return true
373+
374+ else
375+ if pattern .test (url)
376+ return true
377+
378+ return false
379+
365380# If we want to start the progress bar
366381# on every request, we need to hear the request
367382# and then inject it into the new ajax monitor
368383# start will have created.
369384
370- getIntercept ().on ' request' , ({type, request}) ->
385+ getIntercept ().on ' request' , ({type, request, url}) ->
386+ return if shouldIgnoreURL (url)
387+
371388 if not Pace .running and (options .restartOnRequestAfter isnt false or shouldTrack (type) is ' force' )
372389 args = arguments
373390
@@ -396,7 +413,9 @@ class AjaxMonitor
396413
397414 getIntercept ().on ' request' , => @ watch arguments ...
398415
399- watch : ({type, request}) ->
416+ watch : ({type, request, url}) ->
417+ return if shouldIgnoreURL (url)
418+
400419 if type is ' socket'
401420 tracker = new SocketRequestTracker (request)
402421 else
@@ -685,7 +704,7 @@ Pace.go = ->
685704 Pace .running = false
686705
687706 Pace .trigger ' hide'
688- , Math .max (options .ghostTime , Math .min (options .minTime , now () - start))
707+ , Math .max (options .ghostTime , Math .max (options .minTime - ( now () - start), 0 ))
689708 else
690709 enqueueNextFrame ()
691710
0 commit comments