Skip to content

Commit 6b9515f

Browse files
committed
minor
1 parent f2328f0 commit 6b9515f

File tree

1 file changed

+2
-2
lines changed
  • 1-js/06-advanced-functions/09-call-apply-decorators/04-throttle

1 file changed

+2
-2
lines changed

1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Let's check the real-life application to better understand that requirement and
1212

1313
**For instance, we want to track mouse movements.**
1414

15-
In browser we can setup a function to run at every mouse micro-movement and get the pointer location as it moves. During an active mouse usage, this function usually runs very frequently, can be something like 100 times per second (every 10 ms).
15+
In browser we can setup a function to run at every mouse movement and get the pointer location as it moves. During an active mouse usage, this function usually runs very frequently, can be something like 100 times per second (every 10 ms).
1616

1717
**The tracking function should update some information on the web-page.**
1818

1919
Updating function `update()` is too heavy to do it on every micro-movement. There is also no sense in making it more often than once per 100ms.
2020

21-
So we'll assign `throttle(update, 100)` as the function to run on each mouse move instead of the original `update()`. The decorator will be called often, but `update()` will be called at maximum once per 100ms.
21+
So we'll wrap it into the decorator: use `throttle(update, 100)` as the function to run on each mouse move instead of the original `update()`. The decorator will be called often, but `update()` will be called at maximum once per 100ms.
2222

2323
Visually, it will look like this:
2424

0 commit comments

Comments
 (0)