Skip to content

Commit

Permalink
typeof null === 'object', so check for null; allow LiveScript subcomp…
Browse files Browse the repository at this point in the history
…onents
  • Loading branch information
michael-brade committed Sep 2, 2015
1 parent 65858f3 commit aa3f9a1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ App.prototype.component = function(viewName, constructor, ns) {
if (typeof viewName === 'function') {
constructor = viewName;
viewName = null;
} else if (typeof viewName === 'object') {
} else if (viewName != null && typeof viewName === 'object') {
var keys = Object.keys(viewName);
if (keys.length == 1) {
constructor = viewName[keys[0]];
Expand All @@ -191,7 +191,7 @@ App.prototype.component = function(viewName, constructor, ns) {
if (constructor.prototype.name) {
viewName = constructor.prototype.name;
if (ns)
viewName = ns + ':' + viewName;
viewName = ns + ':' + viewName;
var view = this.views.register(viewName);
view.template = templates.emptyTemplate;
} else {
Expand All @@ -207,9 +207,8 @@ App.prototype.component = function(viewName, constructor, ns) {
// Load sub components
var subComponents = constructor.prototype.components;
if (subComponents) {
console.log("loading components: ", subComponents);
for(var i = 0, len = subComponents.length; i < len; i++) {
this.component(null, subComponents[i], viewName);
this.component(subComponents[i], null, viewName);
}
}

Expand Down

0 comments on commit aa3f9a1

Please sign in to comment.