Lint the router files
This commit is contained in:
parent
0539fc651d
commit
a1131eb4f2
2 changed files with 6 additions and 6 deletions
|
|
@ -10,7 +10,7 @@ module.exports = function($window, mount) {
|
||||||
var RouteComponent = {view: function() {
|
var RouteComponent = {view: function() {
|
||||||
return currentRender(Vnode(currentComponent, null, currentArgs, undefined, undefined, undefined))
|
return currentRender(Vnode(currentComponent, null, currentArgs, undefined, undefined, undefined))
|
||||||
}}
|
}}
|
||||||
function defaultRender(vnode){
|
function defaultRender(vnode) {
|
||||||
return vnode
|
return vnode
|
||||||
}
|
}
|
||||||
var route = function(root, defaultRoute, routes) {
|
var route = function(root, defaultRoute, routes) {
|
||||||
|
|
@ -20,7 +20,7 @@ module.exports = function($window, mount) {
|
||||||
|
|
||||||
mount(root, RouteComponent)
|
mount(root, RouteComponent)
|
||||||
|
|
||||||
router.defineRoutes(routes, function(payload, args, path, route) {
|
router.defineRoutes(routes, function(payload, args, path) {
|
||||||
var resolutionIdentifier = globalId = {}
|
var resolutionIdentifier = globalId = {}
|
||||||
var isResolver = typeof payload.view !== "function"
|
var isResolver = typeof payload.view !== "function"
|
||||||
var render = defaultRender
|
var render = defaultRender
|
||||||
|
|
@ -29,14 +29,14 @@ module.exports = function($window, mount) {
|
||||||
if (resolutionIdentifier !== globalId) return
|
if (resolutionIdentifier !== globalId) return
|
||||||
globalId = null
|
globalId = null
|
||||||
|
|
||||||
currentComponent = component != null ? component: isResolver ? "div" : payload
|
currentComponent = component != null ? component : isResolver ? "div" : payload
|
||||||
currentRender = render
|
currentRender = render
|
||||||
currentArgs = args
|
currentArgs = args
|
||||||
currentPath = path
|
currentPath = path
|
||||||
|
|
||||||
root.redraw(true)
|
root.redraw(true)
|
||||||
}
|
}
|
||||||
function onmatch() {
|
var onmatch = function() {
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
if (isResolver) {
|
if (isResolver) {
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ module.exports = function($window) {
|
||||||
|
|
||||||
var asyncId
|
var asyncId
|
||||||
function debounceAsync(f) {
|
function debounceAsync(f) {
|
||||||
return function(){
|
return function() {
|
||||||
if (asyncId != null) return
|
if (asyncId != null) return
|
||||||
asyncId = callAsync(function(){
|
asyncId = callAsync(function() {
|
||||||
asyncId = null
|
asyncId = null
|
||||||
f()
|
f()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue