repeatedly

Types

pub type Repeater(state)

Functions

pub fn call(
  delay_ms: Int,
  state: a,
  function: fn(a, Int) -> b,
) -> Repeater(a)

Call a function every specified number of milliseconds, waiting the number of milliseconds before the first call.

pub fn set_function(
  repeater: Repeater(a),
  function: fn(a, Int) -> b,
) -> Nil

Replace the function being called by a repeater.

On Erlang if the repeater message queue is not empty then this message will handled after all other messages.

On JavaScript there is no message queue so it will stop immediately, though not interrupt the function callback if currently being executed.

pub fn set_state(repeater: Repeater(a), state: a) -> Nil

Set the repeater state.

On Erlang if the repeater message queue is not empty then this message will handled after all other messages.

On JavaScript there is no message queue so it will stop immediately, though not interrupt the function callback if currently being executed.

pub fn stop(repeater: Repeater(a)) -> Nil

Stop the repeater, preventing it from triggering again.

On Erlang if the repeater message queue is not empty then this message will handled after all other messages.

On JavaScript there is no message queue so it will stop immediately, though not interrupt the function callback if currently being executed.

pub fn update_state(
  repeater: Repeater(a),
  function: fn(a) -> a,
) -> Nil

Update the repeater state.

On Erlang if the repeater message queue is not empty then this message will handled after all other messages.

On JavaScript there is no message queue so it will stop immediately, though not interrupt the function callback if currently being executed.

Search Document