use nanolocation (#523)

This commit is contained in:
Yoshua Wuyts
2017-07-01 13:50:14 +02:00
committed by GitHub
parent 0a9689ef7d
commit 711f92a7c1
2 changed files with 3 additions and 6 deletions
+2 -6
View File
@@ -1,5 +1,6 @@
var scrollToAnchor = require('scroll-to-anchor')
var documentReady = require('document-ready')
var nanolocation = require('nanolocation')
var nanotiming = require('nanotiming')
var nanorouter = require('nanorouter')
var nanomorph = require('nanomorph')
@@ -32,6 +33,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._createLocation = nanolocation
this._tree = null
// 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)
return html.toString()
}
Choo.prototype._createLocation = function () {
var pathname = window.location.pathname.replace(/\/$/, '')
var hash = window.location.hash.replace(/^#/, '/')
return pathname + hash
}
+1
View File
@@ -26,6 +26,7 @@
"document-ready": "^2.0.1",
"nanobus": "^4.2.0",
"nanohref": "^2.0.0",
"nanolocation": "^1.0.0",
"nanomorph": "^5.1.2",
"nanoquery": "^1.1.0",
"nanoraf": "^3.0.0",