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
@@ -129,10 +131,10 @@ Choo.prototype.start = function () {
129
131
}
130
132
131
133
this._stores.forEach(function(initStore){
132
-
initStore()
134
+
initStore(self.state)
133
135
})
134
136
135
-
this._matchRoute()
137
+
this._matchRoute(this.state)
136
138
this._tree=this._prerender(this.state)
137
139
assert.ok(this._tree,'choo.start: no valid DOM node returned for location '+this.state.href)
138
140
@@ -194,25 +196,26 @@ Choo.prototype.mount = function mount (selector) {
194
196
}
195
197
196
198
Choo.prototype.toString=function(location,state){
197
-
this.state=xtend(this.state,state||{})
199
+
state=state||{}
200
+
state.events=xtend(this._events)
198
201
199
202
assert.notEqual(typeofwindow,'object','choo.mount: window was found. .toString() must be called in Node, use .start() or .mount() if running in the browser')
200
203
assert.equal(typeoflocation,'string','choo.toString: location should be type string')
201
-
assert.equal(typeofthis.state,'object','choo.toString: state should be type object')
204
+
assert.equal(typeofstate,'object','choo.toString: state should be type object')
202
205
203
-
// TODO: pass custom state down to each store.
206
+
this.emitter.removeAllListeners()
204
207
this._stores.forEach(function(initStore){
205
-
initStore()
208
+
initStore(state)
206
209
})
207
210
208
-
this._matchRoute(location)
209
-
varhtml=this._prerender(this.state)
211
+
this._matchRoute(state,location)
212
+
varhtml=this._prerender(state)
210
213
assert.ok(html,'choo.toString: no valid value returned for the route '+location)
211
214
assert(!Array.isArray(html),'choo.toString: return value was an array for the route '+location)
0 commit comments