glendix/js/timer

Provides typed JavaScript timer handles.

Types

Represents a JavaScript timer handle.

pub type TimerId

Values

pub fn clear_interval(timer timer: TimerId) -> Nil

Cancels a repeating timer.

pub fn clear_timeout(timer timer: TimerId) -> Nil

Cancels a one-shot timer.

pub fn set_interval(
  callback callback: fn() -> Nil,
  every milliseconds: Int,
) -> TimerId

Starts a repeating timer.

pub fn set_timeout(
  callback callback: fn() -> Nil,
  after milliseconds: Int,
) -> TimerId

Starts a one-shot timer.

Search Document