use nanolocation (#523)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
var scrollToAnchor = require('scroll-to-anchor')
|
var scrollToAnchor = require('scroll-to-anchor')
|
||||||
var documentReady = require('document-ready')
|
var documentReady = require('document-ready')
|
||||||
|
var nanolocation = require('nanolocation')
|
||||||
var nanotiming = require('nanotiming')
|
var nanotiming = require('nanotiming')
|
||||||
var nanorouter = require('nanorouter')
|
var nanorouter = require('nanorouter')
|
||||||
var nanomorph = require('nanomorph')
|
var nanomorph = require('nanomorph')
|
||||||
@@ -32,6 +33,7 @@ function Choo (opts) {
|
|||||||
// properties for internal use only
|
// properties for internal use only
|
||||||
this._historyEnabled = opts.history === undefined ? true : opts.history
|
this._historyEnabled = opts.history === undefined ? true : opts.history
|
||||||
this._hrefEnabled = opts.href === undefined ? true : opts.href
|
this._hrefEnabled = opts.href === undefined ? true : opts.href
|
||||||
|
this._createLocation = nanolocation
|
||||||
this._tree = null
|
this._tree = null
|
||||||
|
|
||||||
// properties that are part of the API
|
// properties that are part of the API
|
||||||
@@ -172,9 +174,3 @@ Choo.prototype.toString = function (location, state) {
|
|||||||
assert.ok(html, 'choo.toString: no valid value returned for the route ' + location)
|
assert.ok(html, 'choo.toString: no valid value returned for the route ' + location)
|
||||||
return html.toString()
|
return html.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
Choo.prototype._createLocation = function () {
|
|
||||||
var pathname = window.location.pathname.replace(/\/$/, '')
|
|
||||||
var hash = window.location.hash.replace(/^#/, '/')
|
|
||||||
return pathname + hash
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
"document-ready": "^2.0.1",
|
"document-ready": "^2.0.1",
|
||||||
"nanobus": "^4.2.0",
|
"nanobus": "^4.2.0",
|
||||||
"nanohref": "^2.0.0",
|
"nanohref": "^2.0.0",
|
||||||
|
"nanolocation": "^1.0.0",
|
||||||
"nanomorph": "^5.1.2",
|
"nanomorph": "^5.1.2",
|
||||||
"nanoquery": "^1.1.0",
|
"nanoquery": "^1.1.0",
|
||||||
"nanoraf": "^3.0.0",
|
"nanoraf": "^3.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user