Skip to main content

use_timer

Function use_timer 

Source
pub fn use_timer(interval_ms: u32) -> UseTimer
Expand description

Obtains the UseTimer registered against the current hook context slot.

Behaves like HookContext::use_hook - the same handle is returned on every render at the same hook index, so the tick count survives re-renders.

The interval is created once, on the first render, and is cleared automatically when the component unmounts. A period of zero is treated as one millisecond: a zero-delay interval is a busy loop that would starve the renderer.

§Arguments

  • u32 - The period in milliseconds.

§Returns

  • UseTimer - The handle, with get_ticks() returning the reactive Signal<u64>.