Create a throttled version of a progress callback.
This is a standalone throttle helper, different from the built-in throttle
in ProgressTracker (which uses per-tracker throttling). Use this when you
need to throttle progress across multiple trackers or when using the tracker
without the built-in callback.
Parameters
fn: (snap:ProgressSnapshot)=>void
The callback to throttle
hz: number = 10
Maximum calls per second (default: 10)
Returns (snap:ProgressSnapshot)=>void
Throttled callback that always emits when snap.done is true
Example
constthrottled = throttleProgress((snap) => { console.log(`${snap.percent}%`); }, 5); // max 5 calls per second
Create a throttled version of a progress callback.
This is a standalone throttle helper, different from the built-in throttle in ProgressTracker (which uses per-tracker throttling). Use this when you need to throttle progress across multiple trackers or when using the tracker without the built-in callback.