Skip to content

Commit 90672bf

Browse files
committed
Add option to not start pace on page load
1 parent 1b9940d commit 90672bf

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

pace.coffee

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ defaultOptions =
2626
# Should we restart the browser when pushState or replaceState is called? (Generally
2727
# means ajax navigation has occured)
2828
restartOnPushState: true
29+
30+
# Should pace automatically start when the page is loaded, or should it wait for `start` to
31+
# be called? Always false if pace is loaded with AMD or CommonJS.
32+
startOnPageLoad: true
2933

3034
elements:
3135
# How frequently in ms should we check for the elements being tested for
@@ -166,10 +170,6 @@ class Bar
166170
done: ->
167171
@progress >= 100
168172

169-
# Every 100ms, we decide what the next progress should be
170-
# Every time a new thing happens, we decide what the progress should be
171-
# CSS animations can't give us backoff
172-
173173
class Events
174174
constructor: ->
175175
@bindings = {}
@@ -183,9 +183,10 @@ class Events
183183
@bindings[name] ?= []
184184
@bindings[name].push fn
185185

186-
# We should only ever instantiate one of these
187186
_XMLHttpRequest = window.XMLHttpRequest
188187
_XDomainRequest = window.XDomainRequest
188+
189+
# We should only ever instantiate one of these
189190
class RequestIntercept extends Events
190191
constructor: ->
191192
super
@@ -518,4 +519,5 @@ else if typeof exports is 'object'
518519
module.exports = Pace
519520
else
520521
# Global
521-
Pace.start()
522+
if options.startOnPageLoad
523+
Pace.start()

pace.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pace.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)