From d5f04d2b8ece022541385417b9fbea4b70f9b455 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 24 Jun 2019 12:57:36 +0300 Subject: [PATCH] fixes --- 2-ui/2-events/05-dispatch-events/article.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/2-ui/2-events/05-dispatch-events/article.md b/2-ui/2-events/05-dispatch-events/article.md index 2b13d236..59120896 100644 --- a/2-ui/2-events/05-dispatch-events/article.md +++ b/2-ui/2-events/05-dispatch-events/article.md @@ -241,20 +241,20 @@ Please note that the nested event `menu-open` bubbles up and is handled on the ` That's not only about `dispatchEvent`, there are other cases. JavaScript in an event handler can call methods that lead to other events -- they are too processed synchronously. -If we don't like it, we can either put the `dispatchEvent` (or other event-triggering call) at the end of `onclick` or, if inconvenient, wrap it in `setTimeout(...,0)`: +If we don't like it, we can either put the `dispatchEvent` (or other event-triggering call) at the end of `onclick` or wrap it in zero-delay `setTimeout`: ```html run ``` +Now `dispatchEvent` runs asynchronously after the current code execution is finished, including `mouse.onclick`, so event handlers are totally separate. + ## Summary To generate an event, we first need to create an event object.