Class RouterPartAbstract

Base class for parts that will route based on a list of routes.

Hierarchy

  • Part<{}>
    • RouterPart

Accessors

  • get element(): null | HTMLElement
  • Returns

    Either this part's explicit mount element, or the element found by its id. This will return null if the part is un-attached parts, i.e.:

    • Root elements that have never been mounted
    • Child elements that have never been rendered
    • Child elements that have since been orphaned by their parents

    Returns null | HTMLElement

  • get isAttached(): boolean
  • Returns

    Whether or not the part is currently in the DOM tree with either a parent or a valid DOM element mount point.

    Returns boolean

  • get isRoot(): boolean
  • Returns

    Whether the part is a root part (doesn't have a parent, is mounted directly to a DOM element).

    Returns boolean

  • get name(): string
  • Returns

    the name of the part class.

    Returns string

  • get parentClasses(): string[]
  • Subclasses can override this to provide a list of classes to apply to the parent element.

    Returns string[]

Methods

  • Attaches event listeners to this.element (if needsEventListeners() has been called) Needs to be protected for FormPart.

    Returns void

  • Mark this part as dirty, meaning it needs to be fully re-rendered.

    Returns void

  • Emits a generic message associated with the part (as opposed to a DOM event).

    Type Parameters

    • DataType

    Parameters

    • key: TypedKey<DataType>

      the message key

    • data: DataType

      data associated with the message

    • Optional options: EmitOptions

      configures how the message is emitted

    Returns void

  • Parts can override this to provide custom behavior that is run exactly once before the part is rendered for the first time.

    Returns Promise<void>

  • Computes a new context and loads this and all child parts. Meant to be used by Nav.

    Returns void

  • Register a wildcard listener for all global keyboard events.

    Parameters

    • listener: Listener

      the listener function

    Returns void

  • Mark this part as stale, meaning it needs to be updated but not rendered.

    Returns void

  • Gets called every time the part is rendered.

    Parameters

    • _elem: HTMLElement

      the actual DOM element containing the part

    Returns void

Generated using TypeDoc