Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specification of never using hash routes #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flahertyb
Copy link
Contributor

Some folks might not want to use hash routes, even if the browser doesn't support push state. So I've added a change such that you can specify fallbackToHashRoutes as false. Specifying this option means:

Aviator.dispatch() would still perform the right action based on the url, but calls to navigate trigger full page refreshes, links work as normal, and Aviator doesn't intercept calls to the back button.

With this commit, we are skipping the whole _attachEvents step. To actually have links work as normal, when a root is specified, we need to actually still intercept navigate link clicks so as to prepend the root.

@barnabyc @hojberg @nahiluhmot

Some folks might not want to use hash routes, even if the
browser doesn't support push state. This adds an option
to fallback to full page refreshes upon calls to `navigate`.
@flahertyb
Copy link
Contributor Author

So, still need a commit to fix that link/root situation, and to fix these tests. Curious what y'all think though.

@@ -363,7 +375,7 @@ Navigator.prototype = {
getQueryString: function () {
var uri, queryString;

if (this.pushStateEnabled) {
if (this.pushStateEnabled || !this.fallbackToHashRoutes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.pushStateEnabled || this.fallbackToHashRoutes could probably be refactored into a function since it's now used so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants