Class DrekContext<TStatus>Abstract

Document rendering context.

Can be obtained by drekContextOf function, or provided by rendered fragment.

There are three kinds of rendering contexts:

  1. Document rendering context.

    Such context is always available in document and returned by drekContextOf function for any DOM node connected to the document.

  2. Fragment content rendering context.

    It is created for each rendered fragment and is available via innerContext property. The drekContextOf function returns this context for fragment's content, as well as for each DOM node added to it.

  3. Unrooted rendering context.

    When a DOM node is neither connected to a document, nor part of a rendered fragment's content, the drekContextOf function creates an unrooted context for the root node of that node.

    Unrooted context tracks a document connection and settlement semi-automatically. A lift method can be used to forcibly update them.

    Semi-automatic tracking means that each time an unrooted context created, it is registered for automatic lifting. The lifting happens either asynchronously, or synchronously right before the drekBuild function exit.

    Alternatively, a drekLift function can be used to lift a context of the root node after adding it to another one.

Type Parameters

Hierarchy

Constructors

Properties

document: Document

The document this context belongs to.

fragment: undefined | DrekFragment<[DrekContentStatus]>

A rendered fragment this context is provided by, if any.

nsAlias: NamespaceAliaser

Namespace aliaser to use.

readStatus: AfterEvent<TStatus>

An AfterEvent keeper of content placement status.

scheduler: RenderScheduler

Render scheduler to use.

window: Window

The window this context belongs to.

Accessors

  • get onceConnected(): OnEvent<TStatus>
  • An OnEvent sender of placed content connection event.

    The registered receiver is called when placed content is connected. If connected already the receiver is called immediately.

    Returns OnEvent<TStatus>

  • get whenConnected(): OnEvent<TStatus>
  • An OnEvent sender of single placed content connection event.

    The registered receiver is called when placed content is connected. If connected already the receiver is called immediately.

    In contrast to onceConnected, cuts off the event supply after sending the first event.

    Returns OnEvent<TStatus>

  • get whenSettled(): OnEvent<TStatus>
  • An OnEvent sender of a settlement event.

    Such event can be sent by rendered fragment.

    The same as whenConnected by default.

    Cuts off the event supply after sending the first event.

    Returns OnEvent<TStatus>

Methods

  • Tries to lift this rendering context to enclosing one.

    Tries to find a new root node. If the new root differs from current one, then finds a context of that new root and connects the status of this context to the found one. After successful lifting the context becomes a proxy accessor of the context it is lifted to, so the latter can be used instead.

    This has effect for unrooted contexts only.

    Returns DrekContext<[DrekContentStatus]>

    Either a rendering context of the new root node, or this one.

Generated using TypeDoc