Skip to content

Commit

Permalink
Default hash option to true
Browse files Browse the repository at this point in the history
  • Loading branch information
tornqvist committed Jul 12, 2018
1 parent 6df5ee0 commit bea81e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ Querystrings (e.g. `?foo=bar`) are ignored when matching routes. An object
containing the key-value mappings exists as `state.query`.

### Hash routing
By default hashes are not taken into account when routing. Using hashes to
delimit routes (e.g. `/foo#bar`) is supported if the `hash` options set to
`true`. Regardless, when a hash is found we also check if there's an
available anchor on the same page, and will scroll the screen to the position.
Using both hashes in URLs and anchor links on the page is generally not
recommended.
By default hashes are treated as part of the url when routing. Using hashes to
delimit routes (e.g. `/foo#bar`) can be disabled by setting the `hash`
[option](#app--chooopts) to `false`. Regardless, when a hash is found we also
check if there's an available anchor on the same page, and will scroll the
screen to the position. Using both hashes in URLs and anchor links on the page
is generally not recommended.

### Following links
By default all clicks on `<a>` tags are handled by the router through the
Expand Down Expand Up @@ -534,7 +534,9 @@ Initialize a new `choo` instance. `opts` can also contain the following values:
- __opts.cache:__ default: `undefined`. Override default class cache used by
`state.cache`. Can be a a `number` (maximum number of instances in cache,
default `100`) or an `object` with a [nanolru][nanolru]-compatible API.
- __opts.hash:__ default: `false`. Treat hashes in URLs as part of the pathname, transforming `/foo#bar` to `/foo/bar`. This is useful if the application is not mounted at the website root.
- __opts.hash:__ default: `true`. Treat hashes in URLs as part of the pathname,
transforming `/foo#bar` to `/foo/bar`. This is useful if the application is
not mounted at the website root.

### `app.use(callback(state, emitter, app))`
Call a function and pass it a `state`, `emitter` and `app`. `emitter` is an instance
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Choo (opts) {
// properties for internal use only
this._historyEnabled = opts.history === undefined ? true : opts.history
this._hrefEnabled = opts.href === undefined ? true : opts.href
this._hashEnabled = opts.hash === undefined ? false : opts.hash
this._hashEnabled = opts.hash === undefined ? true : opts.hash
this._hasWindow = typeof window !== 'undefined'
this._cache = opts.cache
this._loaded = false
Expand Down

0 comments on commit bea81e2

Please sign in to comment.