shaco-router
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -6,2 +6,19 @@ import Shaco from 'shadow-component' | ||
let RouterLink = Shaco.ComponentFactory({ | ||
elementName: 'route-link', | ||
template: ` | ||
<content></content> | ||
`, | ||
to (e) { | ||
e.preventDefault() | ||
HistoryManager.push(this.state.to) | ||
}, | ||
view () { | ||
Shaco.createElement('a', null, null, { | ||
href: this.state.to, | ||
onclick: this.to.bind(this) | ||
}, this.state.child) | ||
} | ||
}) | ||
let RouterSelector = Shaco.ComponentFactory({ | ||
@@ -67,11 +84,2 @@ elementName: 'route-selector', | ||
}, | ||
renderChild(child = this.state.child) { | ||
if (typeof child === 'function') { | ||
return child(); | ||
} else if (Array.isArray(child)) { | ||
child.forEach(this.renderChild); | ||
} else { | ||
return child; | ||
} | ||
}, | ||
renderRouteComponent () { | ||
@@ -85,3 +93,3 @@ let selectedRoute = this.getComponentForRoute() | ||
view: function () { | ||
this.renderChild() | ||
this.renderChildren() | ||
this.renderRouteComponent() | ||
@@ -88,0 +96,0 @@ } |
{ | ||
"name": "shaco-router", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Component to deal with history changes with shaco", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,2 +21,17 @@ 'use strict'; | ||
var RouterLink = _shadowComponent2.default.ComponentFactory({ | ||
elementName: 'route-link', | ||
template: '\n <content></content>\n ', | ||
to: function to(e) { | ||
e.preventDefault(); | ||
_history_manager2.default.push(this.state.to); | ||
}, | ||
view: function view() { | ||
_shadowComponent2.default.createElement('a', null, null, { | ||
href: this.state.to, | ||
onclick: this.to.bind(this) | ||
}, this.state.child); | ||
} | ||
}); | ||
var RouterSelector = _shadowComponent2.default.ComponentFactory({ | ||
@@ -77,13 +92,2 @@ elementName: 'route-selector', | ||
}, | ||
renderChild: function renderChild() { | ||
var child = arguments.length <= 0 || arguments[0] === undefined ? this.state.child : arguments[0]; | ||
if (typeof child === 'function') { | ||
return child(); | ||
} else if (Array.isArray(child)) { | ||
child.forEach(this.renderChild); | ||
} else { | ||
return child; | ||
} | ||
}, | ||
renderRouteComponent: function renderRouteComponent() { | ||
@@ -98,3 +102,3 @@ var selectedRoute = this.getComponentForRoute(); | ||
view: function view() { | ||
this.renderChild(); | ||
this.renderChildren(); | ||
this.renderRouteComponent(); | ||
@@ -101,0 +105,0 @@ } |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
15214
12
370
1
45