Forest.js Core Documentation - v1.2.3
    Preparing search index...

    Function addAttribute

    • addAttribute

      Type Parameters

      • E extends Element

        Element type.

      • R extends Partial<E>

        Object with attributes to add.

      • S extends StoreMap<any> = StoreMap<any>

        StoreMap type when used reactively.

      Parameters

      Returns Utility<E>

      Utility function for adding attributes

      Adds attributes to an element. Supports reactive attributes when using stores.

      const addTitle = addAttribute<HTMLDivElement, { title: string }>(
      { title: "Hello" }
      )(MyElement);