Kingdom
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Kingdom

Index

Constructors

constructor

  • constructor

    Create an empty kingdom. If data is supplied then it is made the root node.

    Parameters

    • Default value subject: Subject = {element:'', subjects: []}

      the given subject will initialize the kingdom and become king (root node)

    Returns Kingdom

Accessors

delegateLord

delegateLord:

Retrieves the current node

Methods

addSubject

  • Adds data as a child to the current node. if makeLord is true then the given subject becomes the new current node

    Parameters

    • subject: Subject

      the element you want to add

    • Optional makeLord: boolean

      if true, sets the given subject as lord (current node) and subsequent calls to addSubject will be assigned to this current subject

    Returns Kingdom

banishSubjectAtIndex

  • banishSubjectAtIndex(index: number): boolean
  • Removes the {Subject} at the specified index. Returns false on failure.

    Parameters

    • index: number

      index of the {Subject} you want to remove

    Returns boolean

    • returns true on success

banishSubjectsForCurrentLord

  • banishSubjectsForCurrentLord(): Kingdom

buildKingdom

  • buildKingdom(startAtCurrent: boolean): DocumentFragment
  • returns the DOM structure starting at the root node. If startAtCurrent is true then generates the DOM from the current node instead.

    Parameters

    • startAtCurrent: boolean

      only renders from the current node down

    Returns DocumentFragment

    returns the DOM

createCensus

  • createCensus(): string
  • returns the virtual dom as a string. It will not include functions or complex structures not supported by JSON.stringify and JSON.parse

    Returns string

    stringify version of the virtual DOM

destroyKingdom

  • Removes all the nodes and internally resets the current node to point to the root.

    Returns Kingdom

getLord

  • Internally moves the current node up one level. If the node is the parent then it does nothing

    Returns Kingdom

gotoKing

makeSubjectLordAtIndex

  • makeSubjectLordAtIndex(index: number): Kingdom
  • Internally changes the current node to the child at the given index. The current node remains the same on failure

    Parameters

    • index: number

      index of the subject you want to make current node

    Returns Kingdom

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc