Skip to content

Commit 0444de2

Browse files
committed
minor fixes
1 parent 4584937 commit 0444de2

File tree

1 file changed

+2
-4
lines changed
  • 1-js/06-advanced-functions/09-call-apply-decorators/03-debounce

1 file changed

+2
-4
lines changed

1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ importance: 5
44

55
# Debounce decorator
66

7-
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
7+
The result of `debounce(f, ms)` decorator is a wrapper that suspends calls to `f` until there's `ms` milliseconds of inactivity (no calls, "cooldown period"), then invokes `f` once with the latest arguments.
88

9-
The result of `debounce(f, ms)` decorator should be a wrapper that suspends any calls to `f` and invokes `f` once after `ms` of inactivity.
10-
11-
Let's say we had a function `f` and replaced it with `f = debounce(f, 1000)`.
9+
For instance, we had a function `f` and replaced it with `f = debounce(f, 1000)`.
1210

1311
Then if the wrapped function is called at 0ms, 200ms and 500ms, and then there are no calls, then the actual `f` will be only called once, at 1500ms. That is: after the cooldown period of 1000ms from the last call.
1412

0 commit comments

Comments
 (0)