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 parameter: 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 parameter: 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 parameter1: Parameter,
  otherwise parameter2: 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) -> Parameter,
) -> Parameter

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

Search Document