Skip to content

Commit

Permalink
fix: don't set base if useHash is falsy or if it has been provided
Browse files Browse the repository at this point in the history
Issue #22
  • Loading branch information
troch committed Sep 4, 2015
1 parent b40c905 commit 66ae677
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/router5.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,22 @@ class Router5 {
this.options = {
useHash: false,
hashPrefix: '',
base: browser.getBase(),
base: '',
trailingSlash: 0
}
Object.keys(opts).forEach(opt => this.options[opt] = opts[opt])
this._setBase()
// Bind onPopState
this.boundOnPopState = this.onPopState.bind(this)
}

/**
* @private
*/
_setBase() {
if (this.options.useHash && !this.options.base) this.options.base = browser.getBase()
}

/**
* Set an option value
* @param {String} opt The option to set
Expand All @@ -56,6 +64,7 @@ class Router5 {
*/
setOption(opt, val) {
this.options[opt] = val
if (opt === 'useHash') this._setBase()
return this
}

Expand Down

0 comments on commit 66ae677

Please sign in to comment.