From 0444de2a00eab4ecbc463f7b8889fb07f3091e1c Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Wed, 6 May 2020 22:46:26 +0300 Subject: [PATCH] minor fixes --- .../09-call-apply-decorators/03-debounce/task.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md b/1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md index 714a86c3..27511dc3 100644 --- a/1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md +++ b/1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md @@ -4,11 +4,9 @@ importance: 5 # Debounce decorator - +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. -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. - -Let's say we had a function `f` and replaced it with `f = debounce(f, 1000)`. +For instance, we had a function `f` and replaced it with `f = debounce(f, 1000)`. 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.