Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "diff"

Index

Variables

Const FN

FN: "function" = "function"

Const INDEX

INDEX: any[] = (() => {const res = new Array(2048);for (let i = 2, n = res.length; i < n; i++) {res[i] = i - 2;}return res;})()

Const OBJP

OBJP: any = Object.getPrototypeOf({})

Const STR

STR: "string" = "string"

Const isArray

isArray: isArray = Array.isArray

Const max

max: max = Math.max

Functions

Const buildIndex

  • buildIndex(n: number): any[]

Const decOffsets

  • decOffsets(offsets: any[], j: number, idx: number): void

Const diffAdded

  • diffAdded<T>(opts: Partial<HDOMOpts>, impl: HDOMImplementation<T>, el: T, edits: any[], ii: number, equivKeys: IObjectOf<any[]>, offsets: any[], prevLength: number): void

Const diffAttributes

  • Helper function for diffTree to compute & apply the difference between a node's prev and curr attributes.

    internal

    Type parameters

    • T

    Parameters

    • impl: HDOMImplementation<T>

      hdom implementation

    • el: T

      DOM element

    • prev: any

      previous attributes

    • curr: any

      current attributes

    Returns void

Const diffDeleted

  • diffDeleted<T>(opts: Partial<HDOMOpts>, impl: HDOMImplementation<T>, el: T, prev: any[], curr: any[], edits: any[], ii: number, equivKeys: IObjectOf<any[]>, offsets: any[], prevLength: number): void

Const diffTree

  • See HDOMImplementation interface for further details.

    Type parameters

    • T

    Parameters

    • opts: Partial<HDOMOpts>

      hdom config options

    • impl: HDOMImplementation<T>

      hdom implementation

    • parent: T

      parent element (DOM node)

    • prev: any[]

      previous tree

    • curr: any[]

      current tree

    • Default value child: number = 0

      child index

    Returns any

Const equiv

  • equiv(a: any, b: any): boolean
  • Customized version {@link @thi.ng/equiv#equiv} which takes __diff attributes into account (at any nesting level). If an hdom element's attribute object contains __diff: false, the object will ALWAYS be considered unequal, even if all other attributes in the object are equivalent.

    internal

    Parameters

    • a: any

      -

    • b: any

      -

    Returns boolean

Const extractEquivElements

  • extractEquivElements(edits: any[]): IObjectOf<any[]>

Const incOffsets

  • incOffsets(offsets: any[], j: number, idx: number): void

Const releaseTree

  • releaseTree(tree: any): void
  • Recursively attempts to call the ILifecycle.release lifecycle method on every element in given tree (branch), using depth-first descent. Each element is checked for the presence of the __release control attribute. If (and only if) it is set to false, further descent into that element's branch is skipped.

    internal

    Parameters

    • tree: any

      hdom sub-tree

    Returns void

Generated using TypeDoc