useIntervalFn
Wrapper for setInterval
with controls
Usage
<script>
import { useIntervalFn } from '@svelte-use/core'
const { pause, resume, isActive } = useIntervalFn(() => {
// do something
}, 1000)
</script>
Type Declarations
export interface IntervalFnOptions {
/**
* Start the timer immediately
*
* @default true
*/
immediate?: boolean
/**
* Execute the callback immediate after calling this function
*
* @default false
*/
immediateCallback?: boolean
}
/**
* Wrapper for `setInterval` with controls
*
* @param cb
* @param interval
* @param options
*/
export declare function useIntervalFn(
cb: Fn,
interval?: number,
options?: IntervalFnOptions
): Pausable