Constructor
new TemplateInstance(program, host, localsopt)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
program |
object | The render program to instantiate. |
|||||||||||||||||||||||||||||
host |
object | The owner. Properties
|
|||||||||||||||||||||||||||||
locals |
object | null |
<optional> |
Names this instance binds that its component does not declare, such as a loop's item and index. |
Members
bindings :Array:.<object:>
One entry per op, holding its watcher, its job and whatever state that op kind needs to remember between runs.
Type:
blocks :Array:.<object:>
Blocks this program's control flow can render.
Read from the root program rather than from a block, because a block is
{html, ops, ...} and has no table of its own: nesting is expressed by
index into one table for the whole component.
Type:
compiled :CompiledTemplate
Type:
- CompiledTemplate
disposed :boolean
Type:
- boolean
elements :Array:.<Element:>
Type:
fragment :DocumentFragment|null
Type:
- DocumentFragment | null
host :object
Type:
- object
locals :object|null
Names this instance binds that its component does not declare -- a loop's item and index. Null for a component's root instance.
Held as one mutable object per instance so a reused list row can be given a new value in place, waking only the bindings that read it, instead of being rebuilt.
Type:
- object | null
program :object
Type:
- object
texts :Array:.<Text:>
Type:
usable
Whether the program could be prepared for this host environment.
Methods
create() → {DocumentFragment|null}
Clones the skeleton and runs every binding once.
The bindings run while the tree is still detached, so the first paint sees finished markup rather than a skeleton that fills in.
Returns:
The populated fragment, ready to insert.
- Type
- DocumentFragment | null
dispose()
Releases every effect and forgets every node reference.
Called on unmount. Without it each binding's watcher stays in the dependency sets of the state it read, which keeps the component, its DOM and its scope alive for as long as that state exists.
refresh()
Re-runs every binding, whatever its dependencies say.
Needed when something outside the reactive graph changes what an expression would return -- new props, a swapped bridge, a resource that settled. The fine-grained path handles state; this handles everything else.