@tempots/dom

Repeat() function

Creates a renderable function that repeats a given element a specified number of times.

Signature:

Repeat: (times: Value<number>, element: (index: ElementPosition) => TNode, separator?: (pos: ElementPosition) => TNode) => Renderable

Parameters

Parameter

Type

Description

times

Value

A signal representing the number of times the element should be repeated.

element

(index: ElementPosition) => TNode

A function that returns the element to be repeated, based on the current index.

separator

(pos: ElementPosition) => TNode

(Optional) (Optional) A function that returns the separator element to be inserted between repeated elements.

Returns: Renderable

A renderable function that renders the repeated elements.