Skip to content

Commit

Permalink
fix(useThrottleFn): trailing option should be false by default (#…
Browse files Browse the repository at this point in the history
…1687)

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
webfansplz and antfu committed Jul 6, 2022
1 parent 428f502 commit a76b207
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/shared/useThrottleFn/index.ts
Expand Up @@ -9,13 +9,13 @@ import { createFilterWrapper, throttleFilter } from '../utils'
* to `callback` when the throttled-function is executed.
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
*
* @param [trailing=true] if true, call fn again after the time is up
* @param [trailing=false] if true, call fn again after the time is up
*
* @param [leading=true] if true, call fn on the leading edge of the ms timeout
*
* @return A new, throttled, function.
*/
export function useThrottleFn<T extends FunctionArgs>(fn: T, ms: MaybeRef<number> = 200, trailing = true, leading = true): T {
export function useThrottleFn<T extends FunctionArgs>(fn: T, ms: MaybeRef<number> = 200, trailing = false, leading = true): T {
return createFilterWrapper(
throttleFilter(ms, trailing, leading),
fn,
Expand Down

0 comments on commit a76b207

Please sign in to comment.