Simplified callbacks into a single class with a detach function option so we can use them generically. Patached arrays can have multiple on push/on pop callbacks and moved over to this new model. Needs more testing and cleanup.
This commit is contained in:
@ -600,13 +600,15 @@ class list extends IgniteTemplate {
|
||||
}
|
||||
|
||||
onListChanged(oldValue, newValue) {
|
||||
console.log("On List changed:", newValue);
|
||||
|
||||
this.list = newValue;
|
||||
|
||||
IgniteRenderingContext.enter();
|
||||
|
||||
try {
|
||||
this.construct(null); //The list changed, reconstruct this template.
|
||||
} catch { }
|
||||
} catch (error) { console.error(error); }
|
||||
|
||||
IgniteRenderingContext.leave();
|
||||
}
|
||||
@ -616,7 +618,12 @@ class list extends IgniteTemplate {
|
||||
|
||||
try {
|
||||
var template = this.forEach(this.list[this.list.length - 1]);
|
||||
template.construct(this.element.parentElement, this.elements[this.elements.length - 1].nextSibling);
|
||||
|
||||
if (this.elements.length > 0) {
|
||||
template.construct(this.element.parentElement, this.elements[this.elements.length - 1].nextSibling);
|
||||
} else {
|
||||
template.construct(this.element.parentElement, null);
|
||||
}
|
||||
|
||||
this.children.push(template);
|
||||
this.elements.push(template.element);
|
||||
|
Reference in New Issue
Block a user