turbodombuilder - v0.9.5
    Preparing search index...

    Function define

    • Parameters

      • OptionalelementName: string

        The name of the custom HTML element. It is inferred if omitted.

      • Optionaloptions: DefineOptions = ...

        Custom DefineOptions options object.

      Returns <T extends new (...args: any[]) => HTMLElement>(
          Base: T,
          context: ClassDecoratorContext<T>,
      ) => T

      Stage-3 class decorator factory. It:

      • Registers the element with customElements (name inferred if omitted).
      • Adds the defined (or inferred) customElement name as a class to all instances of this class (and the class's children).
      • Publishes a live observedAttributes getter that lists all attributes associated with @observed fields in this class and its ancestors.
      • Sets up an attributeChangedCallback() function to mirror changes from attributes to their associated @observed fields.
      @define() // name will be "my-el" (kebab case of class name).
      class MyEl extends HTMLElement { ... }

      @define("my-el") // explicit name
      class MyEl extends HTMLElement { ... }