// updateCssVars will be called when subtree changed
if (this.parentComponent && this.parentComponent.ut) {
if (isFragment(nodes)) {
- ;(nodes.effects || (nodes.effects = [])).push(() => updateCssVars(this))
+ ;(nodes.updated || (nodes.updated = [])).push(() => updateCssVars(this))
} else if (isArray(nodes)) {
nodes.forEach(node => {
if (isFragment(node)) {
- ;(node.effects || (node.effects = [])).push(() =>
+ ;(node.updated || (node.updated = [])).push(() =>
updateCssVars(this),
)
}
refKey: string | undefined,
) => void
- // effects to run after fragment render
- effects?: (() => void)[]
+ // hooks
+ updated?: ((nodes?: Block) => void)[]
constructor(nodes: T) {
this.nodes = nodes
scope: EffectScope,
) => boolean)[]
beforeMount?: ((newKey: any, nodes: Block, scope: EffectScope) => void)[]
- mounted?: ((nodes: Block, scope: EffectScope) => void)[]
constructor(anchorLabel?: string) {
super([])
if (parent) {
insert(this.nodes, parent, this.anchor)
- if (this.mounted) {
- this.mounted.forEach(hook => hook(this.nodes, this.scope!))
+ if (this.updated) {
+ this.updated.forEach(hook => hook(this.nodes))
}
}
} else {
this.scope = undefined
this.nodes = []
}
- if (this.effects) this.effects.forEach(effect => effect())
}
hydrate = (isEmpty = false): void => {
}
frag.nodes = vnode.el as any
- if (frag.effects) frag.effects.forEach(effect => effect())
+ if (frag.updated) frag.updated.forEach(m => m())
}
frag.remove = unmount
}
}
- if (frag.effects) frag.effects.forEach(effect => effect())
+ if (frag.updated) frag.updated.forEach(m => m())
}
const render = (parentNode?: ParentNode, anchor?: Node | null) => {