Skip to content

Commit

Permalink
perf: improve throttle
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Oct 28, 2024
1 parent 488b1d9 commit 63a5a76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function throttle(fn: any, delay = 200): () => void {
let start = 0

return function loop(this: unknown, ...args) {
const now = Date.now()
const now = performance.now()
const elapsed = now - start

if (!start) {
Expand Down

0 comments on commit 63a5a76

Please sign in to comment.