You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -142,7 +144,7 @@ Choo.prototype.start = function () {
142
144
initStore(self.state)
143
145
})
144
146
145
-
this._matchRoute()
147
+
this._matchRoute(this.state)
146
148
this._tree=this._prerender(this.state)
147
149
assert.ok(this._tree,'choo.start: no valid DOM node returned for location '+this.state.href)
148
150
@@ -204,26 +206,27 @@ Choo.prototype.mount = function mount (selector) {
204
206
}
205
207
206
208
Choo.prototype.toString=function(location,state){
207
-
this.state=xtend(this.state,state||{})
209
+
state=state||{}
210
+
state.events=xtend(this._events)
208
211
209
212
assert.notEqual(typeofwindow,'object','choo.mount: window was found. .toString() must be called in Node, use .start() or .mount() if running in the browser')
210
213
assert.equal(typeoflocation,'string','choo.toString: location should be type string')
211
-
assert.equal(typeofthis.state,'object','choo.toString: state should be type object')
214
+
assert.equal(typeofstate,'object','choo.toString: state should be type object')
212
215
213
-
varself=this
214
-
this._setCache(this.state)
216
+
this._setCache(state)
217
+
this.emitter.removeAllListeners()
215
218
this._stores.forEach(function(initStore){
216
-
initStore(self.state)
219
+
initStore(state)
217
220
})
218
221
219
-
this._matchRoute(location)
220
-
varhtml=this._prerender(this.state)
222
+
this._matchRoute(state,location)
223
+
varhtml=this._prerender(state)
221
224
assert.ok(html,'choo.toString: no valid value returned for the route '+location)
222
225
assert(!Array.isArray(html),'choo.toString: return value was an array for the route '+location)
0 commit comments