@tempots/dom

MapSignal() function

Maps the values emitted by a signal to a renderable function and returns a new renderable function.

While it is tempting to use MapSignal for its simplicity, it is important to remember that the renderable function returned by MapSignal will be re-rendered every time the signal emits a new value.

In other contexts link Ensure or OneOf, the renderable function is only re-rendered when the signal changes to a state that requires a different renderable function.

Signature:

MapSignal: (value: Value, fn: (value: T) => Renderable) => Renderable

Parameters

Parameter

Type

Description

value

Value

fn

(value: T) => Renderable

The function to map the signal values to renderable functions.

Returns: Renderable

  • A new renderable function that represents the mapped signal.