From 2c01903c9d43d92bb4cbdc42025f8cc888ad9f7c Mon Sep 17 00:00:00 2001 From: josephrocca <1167575+josephrocca@users.noreply.github.com> Date: Fri, 21 Aug 2020 11:23:42 +1000 Subject: [PATCH 1/3] Remove Edge and Firefox warning Supported in Edge 79 and Firefox 78 --- 9-regular-expressions/03-regexp-unicode/article.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/9-regular-expressions/03-regexp-unicode/article.md b/9-regular-expressions/03-regexp-unicode/article.md index defbe15ab8..60d85ff13e 100644 --- a/9-regular-expressions/03-regexp-unicode/article.md +++ b/9-regular-expressions/03-regexp-unicode/article.md @@ -33,12 +33,6 @@ Unlike strings, regular expressions have flag `pattern:u` that fixes such proble ## Unicode properties \p{...} -```warn header="Not supported in Firefox and Edge" -Despite being a part of the standard since 2018, unicode properties are not supported in Firefox ([bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1361876)) and Edge ([bug](https://github.com/Microsoft/ChakraCore/issues/2969)). - -There's [XRegExp](http://xregexp.com) library that provides "extended" regular expressions with cross-browser support for unicode properties. -``` - Every character in Unicode has a lot of properties. They describe what "category" the character belongs to, contain miscellaneous information about it. For instance, if a character has `Letter` property, it means that the character belongs to an alphabet (of any language). And `Number` property means that it's a digit: maybe Arabic or Chinese, and so on. From 858b733ce0ef8bec79c2eaceedf8ee0204eb4c9e Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sat, 22 Aug 2020 10:45:44 +0300 Subject: [PATCH 2/3] Update task.md --- .../09-call-apply-decorators/03-debounce/task.md | 6 +++--- 1 file changed, 3 insertions(+), 3 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 550bf52da2..fa52871a0e 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 @@ -6,6 +6,8 @@ importance: 5 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. +In other words, `debounce` is like a secretary that accepts "phone calls", and waits until there's `ms` milliseconds of being quiet. And only then it transfers the latest call information to "the boss" (calls the actual `f`). + 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. @@ -25,7 +27,6 @@ setTimeout( () => f("c"), 500); // debounced function waits 1000ms after the last call and then runs: alert("c") ``` - Now a practical example. Let's say, the user types something, and we'd like to send a request to the server when the input is finished. There's no point in sending the request for every character typed. Instead we'd like to wait, and then process the whole result. @@ -43,9 +44,8 @@ See? The second input calls the debounced function, so its content is processed So, `debounce` is a great way to process a sequence of events: be it a sequence of key presses, mouse movements or something else. - It waits the given time after the last call, and then runs its function, that can process the result. The task is to implement `debounce` decorator. -Hint: that's just a few lines if you think about it :) \ No newline at end of file +Hint: that's just a few lines if you think about it :) From b85413d0bdd6f4f468fcadeacb4c4056e3671ce1 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sat, 22 Aug 2020 10:46:56 +0300 Subject: [PATCH 3/3] Update task.md --- .../09-call-apply-decorators/04-throttle/task.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md b/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md index 0ab09e640c..6df7af1327 100644 --- a/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md +++ b/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md @@ -12,6 +12,8 @@ The difference with debounce is that it's completely different decorator: - `debounce` runs the function once after the "cooldown" period. Good for processing the final result. - `throttle` runs it not more often than given `ms` time. Good for regular updates that shouldn't be very often. +In other words, `throttle` is like a secretary that accepts phone calls, but bothers the boss (calls the actual `f`) not more often than once per `ms` milliseconds. + Let's check the real-life application to better understand that requirement and to see where it comes from. **For instance, we want to track mouse movements.**