Skip to content

Commit

Permalink
Add option to not start pace on page load
Browse files Browse the repository at this point in the history
  • Loading branch information
zackbloom committed Sep 23, 2013
1 parent 1b9940d commit 90672bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
14 changes: 8 additions & 6 deletions pace.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ defaultOptions =
# Should we restart the browser when pushState or replaceState is called? (Generally
# means ajax navigation has occured)
restartOnPushState: true

# Should pace automatically start when the page is loaded, or should it wait for `start` to
# be called? Always false if pace is loaded with AMD or CommonJS.
startOnPageLoad: true

elements:
# How frequently in ms should we check for the elements being tested for
Expand Down Expand Up @@ -166,10 +170,6 @@ class Bar
done: ->
@progress >= 100

# Every 100ms, we decide what the next progress should be
# Every time a new thing happens, we decide what the progress should be
# CSS animations can't give us backoff

class Events
constructor: ->
@bindings = {}
Expand All @@ -183,9 +183,10 @@ class Events
@bindings[name] ?= []
@bindings[name].push fn

# We should only ever instantiate one of these
_XMLHttpRequest = window.XMLHttpRequest
_XDomainRequest = window.XDomainRequest

# We should only ever instantiate one of these
class RequestIntercept extends Events
constructor: ->
super
Expand Down Expand Up @@ -518,4 +519,5 @@ else if typeof exports is 'object'
module.exports = Pace
else
# Global
Pace.start()
if options.startOnPageLoad
Pace.start()
5 changes: 4 additions & 1 deletion pace.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pace.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 90672bf

Please sign in to comment.