Skip to content

Commit

Permalink
chore: Math
Browse files Browse the repository at this point in the history
  • Loading branch information
vaakian committed Jan 14, 2023
1 parent 7a0c8e8 commit f2bbaf5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/shared/utils/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,14 @@ export function throttleFilter(ms: MaybeComputedRef<number>, trailing = true, le
invoke()
}
else if (trailing) {
const timeout = duration - elapsed

lastValue = new Promise((resolve, reject) => {
lastRejector = rejectOnCancel ? reject : resolve
timer = setTimeout(() => {
lastExec = Date.now()
isLeading = true
resolve(invoke())
clear()
}, timeout > 0 ? timeout : 0)
}, Math.max(0, duration - elapsed))
})
}

Expand Down

0 comments on commit f2bbaf5

Please sign in to comment.