novdom/state/parameter

Apply parameters to components based on a state.

Attention: Only Attribute and Listener parameters are allowed.

Functions

pub fn if1(
  state state: State(a),
  when when: fn(a) -> Bool,
  then parameters: List(Parameter),
) -> Parameter

Applies or removes the given parameter based on the result of the when function.

pub fn if2(
  state1 state1: State(a),
  state2 state2: State(b),
  when when: fn(a, b) -> Bool,
  then parameters: List(Parameter),
) -> Parameter

Applies or removes the given parameter based on the result of the when function.

pub fn ternary1(
  state state: State(a),
  when when: fn(a) -> Bool,
  then parameters1: List(Parameter),
  otherwise parameters2: List(Parameter),
) -> Parameter

Switches between the two given parameters based on the result of the when function.

pub fn utilize(
  state: State(a),
  do: fn(a) -> List(Parameter),
) -> Parameter

Recalculates the given parameters using the do function based on the current state value.

Search Document