Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7151add

Browse files
chore:Add comment to explain throttling behavior in scroll event handler
1 parent 13f8243 commit 7151add

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎snippets/javascript/function-utilities/throttle-function.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const throttle = (func, limit) => {
1818
};
1919

2020
// Usage:
21+
// Ensures the function can only be called once every 1000 milliseconds
2122
const logScroll = throttle(() => console.log("Scroll event triggered"), 1000);
2223

2324
// Attach to scroll event

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /