Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onInsertedChild(childNode: ViewNode, index: number) {
super.onInsertedChild(childNode, index);
if (childNode instanceof TemplateElement) {
let type = childNode.getAttribute('type') || ListViewViewType.ItemView
if (type.toLowerCase() != ListViewViewType.ItemView.toLowerCase()) return;
let key = childNode.getAttribute('key') || "default"
logger.debug(`Adding template for key ${key}`);
if (!this.nativeView.itemTemplates || typeof this.nativeView.itemTemplates == "string") {
this.nativeView.itemTemplates = []
}
this.nativeView.itemTemplates = this.nativeView.itemTemplates.concat(new SvelteKeyedTemplate(key, childNode))
}
}