From 2a92ea3902fcb0dff06076c737d0aa5fa4239bb7 Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Wed, 24 Jul 2024 00:35:04 +0900 Subject: [PATCH] Update files/en-us/web/javascript/event_loop/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- files/en-us/web/javascript/event_loop/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/javascript/event_loop/index.md b/files/en-us/web/javascript/event_loop/index.md index aa22bcb51648c05..1d1c5396835f66c 100644 --- a/files/en-us/web/javascript/event_loop/index.md +++ b/files/en-us/web/javascript/event_loop/index.md @@ -77,7 +77,7 @@ A downside of this model is that if a message takes too long to complete, the we ### Adding messages -In web browsers, messages are often added when an event occurs and there is an event listener attached to it. If there is no listener, the event is lost. So a click on an element with a click event handler will add a message — likewise with any other event. However, some events happen synchronously without a message — for example, simulated clicks via the {{domxref("HTMLElement/click", "click")}} method. +In web browsers, messages are often added when an event occurs and there is an event listener attached to it. If there is no listener, the event is lost. So a click on an element with a click event handler will add a message — likewise with any other event. However, some events happen synchronously without a message — for example, simulated clicks via the {{domxref("HTMLElement/click", "click")}} method. The first two arguments to the function [`setTimeout`](/en-US/docs/Web/API/setTimeout) are a message to add to the queue and a time value (optional; defaults to `0`). The _time value_ represents the (minimum) delay after which the message will be pushed into the queue. If there is no other message in the queue, and the stack is empty, the message is processed right after the delay. However, if there are messages, the `setTimeout` message will have to wait for other messages to be processed. For this reason, the second argument indicates a _minimum_ time — not a _guaranteed_ time.