Turbine
- Package
- purescript-turbine
- Repository
- funkia/purescript-turbine
#dynamic Source
dynamic :: forall o a. Behavior (Component a o) -> Component (Behavior o) (Record ())
Turns a behavior of a component into a component of a behavior. This function is used to create dynamic HTML where the structure of the HTML should change over time.
dynamic (map (\b -> if b else (div {} ) then) behavior)
#component Source
component :: forall p o a. (o -> Now (ComponentResult a o p)) -> Component p (Record ())
#ComponentResult Source
type ComponentResult a o p = { available :: p, component :: Component a o }
#output Source
output :: forall f p o a. Applicative f => Component a o -> p -> f (ComponentResult a o p)
#MapRecord Source
#static Source
static :: forall row c a. RowToList row c => MapRecord c row Behavior () a => Record row -> Record a
A helper function used to convert static values in records into constant behaviors.
Component functions often takes a large amount of behaviors as input. But, sometimes all that is required is static values, that is, constant behaviors. In these cases it can sometimes be tedious to write records like the following:
{ foo: pure 1, bar: pure 2, baz: pure 3, more: pure 4, fields: pure 5 }
The static
function applies pure
to each value in the given record. As
such, the above can be shortened into the following.
static { foo: 1, bar: 2, baz: 3, more: 4, fields: 5 }
#withStatic Source
withStatic :: forall xs p' q' q p o. RowToList p xs => MapRecord xs p Behavior () p' => Union o p' q' => Nub q' q => Record o -> Record p -> Record q
A function closely related to static
. Usefull in cases where a component
function is to be supplied with both a set of static values (constant
behaviors). The function applies static
to its seconds argument and
merges the two records.
It is often used in infix form as in the following example.
{ foo: behA, bar: behB } `withStatic` { baz: 3, more: 4, fields: 5 }
- Modules
- Turbine
- Turbine.
HTML