Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/17'
Browse files Browse the repository at this point in the history
Conflicts:
	pace.js
	pace.min.js
  • Loading branch information
zackbloom committed Sep 23, 2013
2 parents 2283217 + 1b7e0d5 commit 07b2691
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
28 changes: 25 additions & 3 deletions pace.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ defaultOptions =

# This tweaks the animation easing
easeFactor: 1.25

# 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

# 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
# Should pace automatically restart when a Backbone route change occurs? Can also be an
# array of route names. Ignored if Backbone.js is not included on the page.
restartOnBackboneRoute: true

elements:
# How frequently in ms should we check for the elements being tested for
Expand Down Expand Up @@ -415,6 +419,24 @@ if window.history.replaceState?

_replaceState.apply window.history, arguments

if options.restartOnBackboneRoute
# Bind in a timeout, as it's possible Backbone hasen't been
# included yet
setTimeout ->
return unless window.Backbone?

Backbone.History.on 'route', (router, name) ->
return unless rule = options.restartOnBackboneRoute

if typeof rule is 'object'
# It's an array of route names
for routeName in rule when routeName is name
Pace.restart()
break
else
Pace.restart()
, 0

SOURCE_KEYS =
ajax: AjaxMonitor
elements: ElementMonitor
Expand Down
31 changes: 30 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 07b2691

Please sign in to comment.