Skip to content

Commit

Permalink
Don't trigger a backbone restart on the initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
zackbloom committed Sep 23, 2013
1 parent 47db5c4 commit 8ac5f53
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pace
====

Include [pace.js](https://raw.github.com/HubSpot/pace/v0.4.6/pace.min.js) and the
Include [pace.js](https://raw.github.com/HubSpot/pace/v0.4.7/pace.min.js) and the
[theme](http://github.hubspot.com/pace/docs/welcome/) css of your choice on your page
(as early as is possible), and you're done!

Expand Down
2 changes: 1 addition & 1 deletion docs/welcome/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ <h2>What is Pace?</h2>
<p style="text-align: left">No need to hook into any of your code, progress is detected automatically.</p>
<br/>
<h2>Download</h2>
<p><a class="button" href="https://raw.github.com/HubSpot/pace/v0.4.6/pace.min.js">Pace.js</a></p>
<p><a class="button" href="https://raw.github.com/HubSpot/pace/v0.4.7/pace.min.js">Pace.js</a></p>
<br/>
<h2>Themes</h2>
<label class="color-label" for="color-select">Enter a color:</label>
Expand Down
6 changes: 6 additions & 0 deletions pace.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ if window.history.replaceState?

_replaceState.apply window.history, arguments

firstLoad = true
if options.restartOnBackboneRoute
# Bind in a timeout, as it's possible Backbone hasen't been
# included yet
Expand All @@ -428,6 +429,11 @@ if options.restartOnBackboneRoute
Backbone.history.on 'route', (router, name) ->
return unless rule = options.restartOnBackboneRoute

if firstLoad
# We don't want to do anything on the initial route
firstLoad = false
return

if typeof rule is 'object'
# It's an array of route names
for routeName in rule when routeName is name
Expand Down
8 changes: 7 additions & 1 deletion pace.js

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

Loading

0 comments on commit 8ac5f53

Please sign in to comment.