es-toolkit icon indicating copy to clipboard operation
es-toolkit copied to clipboard

Throttle with custom edges options works just like a debounce.

Open FourwingsY opened this issue 5 months ago • 3 comments

const throttledOnScroll = throttle(onScroll, 100, { edges: ["trailing"] })

This code expects to work like a "Throttle" function, Which invokes onScroll function every 100ms while I keep scrolling, AND Just last trailing call even if scroll ends within delayed 100ms.

but that code just works like debounce. kept scrolling 10s, but just a single call at the last moment.

Is this intended? I couldn't find expected behaviors on function/throttle.spec.ts with these options set.

FourwingsY avatar Jun 17 '25 11:06 FourwingsY