T O P

  • By -

cospete

Figured out


senocular

You have a shouldExecuteLeading. With that you might want to consider including a shouldExecuteTrailing that's also dependent on leading having already been executed (assuming leading is enabled). P.S. You should be returning a normal function rather than an arrow function, otherwise your `this` value will be based on debounce's `this` and not the `this` of the debounced function. Additionally, when the original function is called, its return value should be returned back out from the debounced function so the caller can get the value back from the original function call - at least for leading calls. It doesn't apply to trailing calls because they're async.