forked from flatiron/director
-
Notifications
You must be signed in to change notification settings - Fork 3
add replaceRoute api #10
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
Open
albertalquisola
wants to merge
1
commit into
CodeYellowBV:master
Choose a base branch
from
albertalquisola:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,6 @@ | |
| node_modules | ||
| npm-debug.log | ||
| .DS_Store | ||
| build | ||
|
|
||
| /test/browser/browserified-bundle.js | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to support old browsers, you could also load this separately and put it in the global namespace. Many users don't have to support old browsers so this would add extra weight.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, not sure i follow about the global namespace implementation? not sure how that would make the build smaller if were still requiring it in? Mind explaining in a little more detail?
And i just assumed since this library supports legacy browsers that new APIs should do the same. I think it would be inconsistent behavior if some APIs supported legacy browsers while others did not.
eg. setRoute vs. replaceRoute. setRoute supports older versions of IE but without the history polyfill, replaceRoute would only support up to IE 10 or 11 I think.
What do you think?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't make the build smaller for users that choose to include the polyfill, but it would make the build smaller for users who don't have to support these old browsers because they just won't include it. I don't like including a 10kb polyfill (minified) in my app that I don't even need. That would make Tarantino twice as big.
You're right in that Tarantino does support legacy browsers, but that is only for the hash-based router since basic support for that is already present in those browsers (albeit with some inconsistencies, which this library fixes).
Note that I'm also new to this library, so bear with me if I made any mistakes.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think I see what you're saying. Just to clarify and make sure we're on the same page, you want each individual project to require in the polyfill (if they need it) vs. tarantino doing it by default?
And then inside tarantino, it would either use the polyfill or default to the
window.history.replaceStateor something of that sort correct?eg.
Am I understanding this correctly? If I am, the only caveat is that we need to provide explicit instructions on how to inject the polyfill into the global namespace.
eg.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend users to overwrite
window.historywith the polyfill if the object isundefined. The polyfill you found, html5-history-api, is spec compliant, so this wouldn't cause any issues. This is how most libraries handle polyfills now AFAIK.