Options
All
  • Public
  • Public/Protected
  • All
Menu

The IElmVN interface represents a virtual node for a DOM element.

Type parameters

  • T: Element = Element

Hierarchy

Index

Properties

Optional Readonly creator

creator?: null | IComponent<{}, {}>

Component that created this node.

Optional Readonly depth

depth?: number

Level of nesting at which the node resides relative to the root node.

Readonly elm

elm: null | Element

Gets the DOM element object.

Readonly elmName

elmName: string

Gets the DOM element name.

Readonly index

index: number

Zero-based index of this node in the parent's list of sub-nodes. This is zero for the root nodes that don't have parents.

Optional Readonly name

name?: string

Gets node's display name. This is used mostly for tracing and error reporting. The name can change during the lifetime of the virtual node; for example, it can reflect an "id" property of an element.

Optional Readonly parent

parent?: null | IVNode

Gets node's parent. This is undefined for the top-level (root) nodes.

Optional Readonly subNodes

subNodes?: null | IVNode[]

List of sub-nodes.

Methods

getService

  • Retrieves the value for a service with the given ID registered by a closest ancestor component or the default value if none of the ancestor components registered a service with this ID. This method doesn't establish a subscription and only reflects the current state.

    Type parameters

    • K: "ErrorBoundary"

    Parameters

    • id: K

      Unique service identifier

    • Optional defaultValue: IServiceDefinitions[K]

      Default value to return if no publish service is found.

    • Optional useSelf: boolean

      Flag indicating whether the search for the service should start from the virtual node that calls this method. The default value is false meaning the search starts from the parent virtual node.

    Returns IServiceDefinitions[K]

    Current value of the service or default value if no published service is found.

growChildren

  • growChildren(startContent?: any, endContent?: any, schedulingType?: TickSchedulingType): void
  • Adds the given content at the start and/or at the end of the existing children.

    Parameters

    • Optional startContent: any
    • Optional endContent: any
    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

moveChildren

  • moveChildren(index: number, count: number, shift: number, schedulingType?: TickSchedulingType): void
  • Moves a range of sub-nodes to a new location.

    Parameters

    • index: number

      Starting index of the range.

    • count: number

      Number of sub-nodes in the range.

    • shift: number

      Positive or negative number of positions the range will be moved.

    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

reverseChildren

  • reverseChildren(startIndex?: number, endIndex?: number, schedulingType?: TickSchedulingType): void
  • Reverses sub-nodes within the given range.

    Parameters

    • Optional startIndex: number

      Index of the first sub-node in the range. If undefined, the array of sub-nodes starts at index 0.

    • Optional endIndex: number

      Index of the sub-node after the last sub-node in the range. If this parameter is zero or undefined or greater than the length of the sub-nodes array, the range will include all sub-nodes from the startIndex to the end of the array.

    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

setChildren

  • setChildren(content?: any, startIndex?: number, endIndex?: number, update?: boolean, updateStrategy?: UpdateStrategy, schedulingType?: TickSchedulingType): void
  • Replaces the given range of sub-nodes with the new content. The update parameter determines whether the old sub-nodes are simply removed and the new added or the new content is used to update the old sub-nodes.

    Parameters

    • Optional content: any

      New content to replace the range of old sub-nodes.

    • Optional startIndex: number

      Index of the first sub-node in the range to be replaced by the new content. If undefined, the default value is 0.

    • Optional endIndex: number

      Index after the last sub-node in the range to be replaced by the new content. If undefined, the range includes all sub-nodes from startIndex to the end.

    • Optional update: boolean

      If false, the old sub-nodes are removed and the new ones are inserted. If true, the reconciliation process is used to update the old sub-nodes with the new ones. The default value is false.

    • Optional updateStrategy: UpdateStrategy

      If the reconciliation process is used (that is, the update parameter is true), determines the update strategy. If undefined, the update strategy of the node itself is used.

    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

setProps

  • Requests update of the element properties without re-rendering of its children.

    Parameters

    Returns void

sliceChildren

  • sliceChildren(startIndex: number, endIndex?: number, schedulingType?: TickSchedulingType): void
  • Retains the given range of the sub-nodes unmounting the sub-nodes outside this range. This method operates similar to the Array.prototype.slice method.

    Parameters

    • startIndex: number

      Index of the first sub-node in the range. If undefined, the array of sub-nodes starts at index 0.

    • Optional endIndex: number

      Index of the sub-node after the last sub-node in the range. If this parameter is zero or undefined or greater than the length of the sub-nodes array, the range will include all sub-nodes from the startIndex to the end of the array.

    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

spliceChildren

  • spliceChildren(index: number, countToDelete?: number, contentToInsert?: any, schedulingType?: TickSchedulingType): void
  • At the given index, removes a given number of sub-nodes and then inserts the new content.

    Parameters

    • index: number
    • Optional countToDelete: number
    • Optional contentToInsert: any
    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

swapChildren

  • swapChildren(index1: number, count1: number, index2: number, count2: number, schedulingType?: TickSchedulingType): void
  • Swaps two ranges of the element's sub-nodes. The ranges cannot intersect.

    Parameters

    • index1: number
    • count1: number
    • index2: number
    • count2: number
    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void

trimChildren

  • trimChildren(startCount: number, endCount: number, schedulingType?: TickSchedulingType): void
  • Removes the given number of nodes from the start and/or the end of the list of sub-nodes.

    Parameters

    • startCount: number
    • endCount: number
    • Optional schedulingType: TickSchedulingType

      Type determining whether the operation is performed immediately or is scheduled to a Mimbl tick.

    Returns void