Skip to content

Commit

Permalink
Update files/en-us/web/javascript/event_loop/index.md
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
sideshowbarker and github-actions[bot] authored Jul 23, 2024
1 parent f37b822 commit 2a92ea3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/en-us/web/javascript/event_loop/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 2a92ea3

Please sign in to comment.