Skip to content

Commit

Permalink
fix(Component): Fixed argument order on templiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdwilliams committed Jul 14, 2018
1 parent 101bce7 commit 5d8b2ed
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 80 deletions.
17 changes: 10 additions & 7 deletions dist/templiteral.cjs.js
Expand Up @@ -78,9 +78,8 @@ class AttributeNode {
console.error(`Method ${handlerName} is not a method of element ${this.context.tagName}`);
} else {
const handler = this.context[handlerName].bind(this.context);
this.node.addEventListener(eventName, this.context[handlerName].bind(this.context));
this.node.addEventListener(eventName, handler);
this.node._boundEvents = handler;

}
}
});
Expand Down Expand Up @@ -223,9 +222,13 @@ class Template {

for (let i = 0; i < values.length; i += 1) {
if (values[i] !== this.oldValues[i]) {
window.requestAnimationFrame(() =>
this.partIndicies.get(i).update(values)
);
window.requestAnimationFrame(() => {
try {
this.partIndicies.get(i).update(values);
} catch(e) {
console.log(this.partIndicies.get(i), i, values[i]);
}
});
}
}
}
Expand Down Expand Up @@ -330,7 +333,7 @@ class Component extends HTMLElement {
Object.defineProperty(this, 'templiteral', {
get() {
const location = self.shadowRoot ? self.shadowRoot : self;
return templiteral(self, location);
return templiteral(location, self);
},
enumerable: false,
configurable: false
Expand All @@ -341,7 +344,7 @@ class Component extends HTMLElement {
get() {
return (...args) => {
window.requestAnimationFrame(() => Reflect.apply(self.templiteral, self, args));
}
};
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/templiteral.cjs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions dist/templiteral.es.js
Expand Up @@ -74,9 +74,8 @@ class AttributeNode {
console.error(`Method ${handlerName} is not a method of element ${this.context.tagName}`);
} else {
const handler = this.context[handlerName].bind(this.context);
this.node.addEventListener(eventName, this.context[handlerName].bind(this.context));
this.node.addEventListener(eventName, handler);
this.node._boundEvents = handler;

}
}
});
Expand Down Expand Up @@ -219,9 +218,13 @@ class Template {

for (let i = 0; i < values.length; i += 1) {
if (values[i] !== this.oldValues[i]) {
window.requestAnimationFrame(() =>
this.partIndicies.get(i).update(values)
);
window.requestAnimationFrame(() => {
try {
this.partIndicies.get(i).update(values);
} catch(e) {
console.log(this.partIndicies.get(i), i, values[i]);
}
});
}
}
}
Expand Down Expand Up @@ -326,7 +329,7 @@ class Component extends HTMLElement {
Object.defineProperty(this, 'templiteral', {
get() {
const location = self.shadowRoot ? self.shadowRoot : self;
return templiteral(self, location);
return templiteral(location, self);
},
enumerable: false,
configurable: false
Expand All @@ -337,7 +340,7 @@ class Component extends HTMLElement {
get() {
return (...args) => {
window.requestAnimationFrame(() => Reflect.apply(self.templiteral, self, args));
}
};
}
});
}
Expand Down

0 comments on commit 5d8b2ed

Please sign in to comment.