Pluralize "times" correctly

This commit is contained in:
Juan Soto
2016-07-15 09:22:26 -04:00
parent 17959b8105
commit 9fb124cf1c
12 changed files with 305 additions and 38 deletions
+9 -2
View File
@@ -6,6 +6,7 @@ const href = require('sheet-router/href')
const hash = require('sheet-router/hash')
const hashMatch = require('hash-match')
const barracks = require('barracks')
const nanoraf = require('nanoraf')
const assert = require('assert')
const xtend = require('xtend')
const yo = require('yo-yo')
@@ -22,6 +23,7 @@ function choo (opts) {
var _defaultRoute = null
var _rootNode = null
var _routes = null
var _frame = null
start.toString = toString
start.router = router
@@ -85,8 +87,13 @@ function choo (opts) {
opts.onStateChange(data, state, prev, name, createSend)
}
const newTree = _router(state.location.pathname, state, prev)
_rootNode = yo.update(_rootNode, newTree)
if (!_frame) {
_frame = nanoraf(function (state, prev) {
const newTree = _router(state.location.pathname, state, prev)
_rootNode = yo.update(_rootNode, newTree)
})
}
_frame(state, prev)
}
// register all routes on the router