Class: DeferBinding

lib/core/renderer/program/blocks.DeferBinding(anchor, createInstance, blocks, locals, onBlockMountedopt)

Renders a block once its trigger fires.

<@defer> had two pinned defects, and both were consequences of it living in markup. The deferred content was a <div data-ax-defer> the runtime searched for on every update: a component inside it rendered a placeholder that nothing ever mounted, because the mounting pass ran before the content existed and was never told it appeared; and any unrelated state change re-rendered the enclosing template, which replaced the container and threw away the trigger that had been attached to it.

A block has neither problem by construction. It is owned by its binding rather than by a diff, so an unrelated update cannot touch it, and mounting is announced through the same hook every other block uses.

Constructor

new DeferBinding(anchor, createInstance, blocks, locals, onBlockMountedopt)

Parameters:
Name Type Attributes Description
anchor Text

The op's anchor.

createInstance function

Builds a template instance for a block.

blocks Array:.<object:>

The program's block table.

locals object | null

The enclosing block's local bindings.

onBlockMounted function <optional>

Announces a mounted block.

Source:

Members

armed :boolean

Type:
  • boolean
Source:

placeholderRange :BlockRange|null

Type:
  • BlockRange | null
Source:

range :BlockRange|null

Type:
  • BlockRange | null
Source:

teardowns :Array:.<function(): void:>

Type:
  • Array:.<function(): void:>
Source:

Methods

dispose()

Releases the trigger and the rendered block.

Source:

update(op, evaluate)

Arms the trigger, or renders immediately when an expression trigger is true.

Parameters:
Name Type Description
op object

The defer op.

evaluate function

Evaluates an expression index.

Source: