global.setInterval
Shares ids with setTimeout: clearTimeout and clearInterval cancel either.
Usage
Start and stop a timer
import { Text, onMount, signal } from 'kuito';
export function ElapsedTime() {
const seconds = signal(0);
onMount(() => {
const timer = setInterval(() => seconds.value++, 1000);
return () => clearInterval(timer);
});
return <Text>{`${seconds.value} seconds on this screen`}</Text>;
}Signatures
<A extends unknown[]>(callback: (...args: A) => void, delay?: number, ...args: A): numberType parameters
| Name | Constraint | Default |
|---|---|---|
A | unknown[] | — |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
callback | (...args: A) => void | Yes | — |
delay | number | No | — |
...args | A | Yes | — |
Returns
number
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.