Seitu - Type-Safe Utilities
Core

Throttle Fn

createThrottleFn()

Wraps a plain function in a throttled callable that also acts as a subscribable.

The first call fires immediately. Subsequent calls within the wait window are batched — only the last one fires when the interval elapses. The return value of the wrapped function becomes the current state, notifying subscribers.

Examples

import {  } from 'seitu'

const  = ((: string) => .(), 300)
.( => .('result:', ))
('hello') // fires immediately
('world') // throttled — fires after 300ms
.() // latest return value (undefined until first call)

On this page