Module Relude_Throttle

type throttled = {
cancel: unit => unit,
isThrottled: unit => bool,
f: unit => unit,
};

The data returned from the throttle function.

let throttle: delayMS:int => ?⁠leading:bool => (unit => unit) => throttled;

The throttle function takes a unit => unit function and returns a new function (and other control values) which when used, suppresses calls to the given function to only once within the given delayMS.

This is useful for sampling a stream of function calls on some interval.

If leading is given as true, the function will be allowed to run on the first call before the throttling behavior kicks in.