useInterval ​
Hook that makes and interval and returns controlling functions
typescript
import { useInterval } from '@elysiumorg/solid-use';Usage ​
typescript
const { isActive, pause, resume } = useInterval(() = > console.log('inside interval'), 2500);
Demo ​
Api ​
Parameters
| Name | Type | Default | Note | 
|---|---|---|---|
| callback | () => void | - | Any callback function | 
| interval? | number | 1000 | Time in milliseconds | 
| options.enabled? | boolean | true | Start the interval immediately |