Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ElementBuilder<T>

The element builder provides services to define and register CustomElement.

Type parameters

  • T: HTMLElement

Hierarchy

  • ElementBuilder

Implements

Index

Constructors

constructor

Properties

Private builders

builders: Array<Builder>

Private elConstructor

elConstructor: CustomElementConstructor<T>

Private Optional elExtends

elExtends: string

Private elName

elName: string

Private hooks

Methods

after

  • after<K>(name: K, callback: HookCallbacks[K]): this
  • Register a hook which will be invoked after the execution of regular hooks.

    Type parameters

    Parameters

    • name: K

      the name

    • callback: HookCallbacks[K]

      the callback

    Returns this

before

  • before<K>(name: K, callback: HookCallbacks[K]): this
  • Register a hook which will be invoked before the execution of regular hooks.

    Type parameters

    Parameters

    • name: K

      the name

    • callback: HookCallbacks[K]

      the callback

    Returns this

builder

  • builder(...builders: Array<Builder>): this
  • A list of builder used to enhance the CustomElement.

    Parameters

    • Rest ...builders: Array<Builder>

      a list of builders

    Returns this

extends

  • extends(tagName: string): this
  • The tag name of the extended HTML element.

    Parameters

    • tagName: string

      the tag name

    Returns this

invoke

  • invoke(type: "before" | "between" | "after", name: string, cb: (callback: Function) => void): void
  • Invokes the registered hooks.

    Parameters

    • type: "before" | "between" | "after"

      the type

    • name: string

      the name

    • cb: (callback: Function) => void

      the callback

        • (callback: Function): void
        • Parameters

          • callback: Function

          Returns void

    Returns void

name

  • name(tagName: string): this
  • The tag name of the custom element. By default it is the kebab case of the class name.

    Parameters

    • tagName: string

      the tag name

    Returns this

on

  • on<K>(name: K, callback: HookCallbacks[K]): this

register

Static element

  • Class decorator used to register a CustomElement.

    Type parameters

    • T: HTMLElement

    Parameters

    Returns (Anonymous function)

Static get

Static getOrSet

  • getOrSet<B>(target: HTMLElement, id: string, builder: B): B
  • Get or set builder to a target.

    Type parameters

    Parameters

    • target: HTMLElement

      the target

    • id: string

      the id used to identify the builder

    • builder: B

      the builder

    Returns B

Generated using TypeDoc