• Throttle returns a function that limits the rate of invocations.

    Parameters

    • inner: (() => void)

      The function to invoke at a throttled rate.

        • (): void
        • Returns void

    • duration: number

      The interval (in seconds) for which the throttled function will be limited.

    • options: Partial<ThrottleOptions> = defaultThrottleOptions

      Options for which ends of the window the function should be invoked. If omitted, leading and trailing will be true.

    Returns ThrottledCallback

    Returns a method that, when invoked, will invoke the inner method at a throttled rate. The returned method will have a dispose handle to clear any active timers and prevent further invocation.