Type Alias CreateOptions<In>

CreateOptions<In>: {
    afterInsert: ((element: HTMLElement) => void);
    beforeInsert: ((element: HTMLElement) => void);
    beforeRemove: ((element: HTMLElement) => void);
    byReference: boolean;
    key: ((value: In) => string);
    parentEl: string | HTMLElement;
    tagName: string;
}

Type Parameters

  • In

Type declaration

  • afterInsert: ((element: HTMLElement) => void)

    Called after an element is inserted to the parent element

      • (element): void
      • Parameters

        • element: HTMLElement

        Returns void

  • beforeInsert: ((element: HTMLElement) => void)

    Called whenever an element is created but not yet added to parent element

      • (element): void
      • Parameters

        • element: HTMLElement

        Returns void

  • beforeRemove: ((element: HTMLElement) => void)

    Called after an element has been removed

      • (element): void
      • Parameters

        • element: HTMLElement

        Returns void

  • byReference: boolean

    Default: false. When true, associate created elements to values by reference rather than value. This can be useful with mutable values.

    Use this or the key option.

  • key: ((value: In) => string)

    When set, provide a custom function to return a unique key for a value. This is used for matching values with elements when using immutable data.

    By default uses the JSON.stringify() representation.

    To match elements with values by reference, set byReference instead.

      • (value): string
      • Parameters

        Returns string

  • parentEl: string | HTMLElement

    Parent element to create elements in. Defaults to document.body.

  • tagName: string

    What kind of HTML element to make, defaults to DIV