Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useThrottleFn): trailing option should be false by default #1687

Merged
merged 2 commits into from Jul 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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