move ._handler off state (#637)

This commit is contained in:
Yoshua Wuyts
2018-03-14 12:25:26 +01:00
committed by GitHub
parent 74b5f9418e
commit b1fa6f19af
+2 -2
View File
@@ -222,17 +222,17 @@ Choo.prototype._matchRoute = function (locationOverride) {
queryString = window.location.search queryString = window.location.search
} }
var matched = this.router.match(location) var matched = this.router.match(location)
this._handler = matched.cb
this.state.href = location this.state.href = location
this.state.query = nanoquery(queryString) this.state.query = nanoquery(queryString)
this.state.route = matched.route this.state.route = matched.route
this.state.params = matched.params this.state.params = matched.params
this.state._handler = matched.cb
return this.state return this.state
} }
Choo.prototype._prerender = function (state) { Choo.prototype._prerender = function (state) {
var routeTiming = nanotiming("choo.prerender('" + state.route + "')") var routeTiming = nanotiming("choo.prerender('" + state.route + "')")
var res = state._handler(state, this.emit) var res = this._handler(state, this.emit)
routeTiming() routeTiming()
return res return res
} }