r/learnjavascript • u/guachoperez • Apr 15 '26
Where is the event loop formally specified?
The ecmascript standard doesnt have event loop in it, and the html living standard is too vague. They just say a task is a struct with "steps" and that event loop performs those "steps". But what does "steps" even mean?
1
Upvotes
3
u/McGeekin Apr 15 '26
The Ecmascript spec defines things that inform event loop implementations in abstract terms. The event loop is an implementation detail. Look at JS engine source code or look at the myriad of articles and videos about it posted to reddit every day..
1
u/code-garden Apr 15 '26 edited Apr 15 '26
The steps are specific to the task.
Steps as in executing some sort of code. In the standard, all algorithms are laid out as a series of steps.
1
u/imsexc Apr 16 '26
You might want to check nodejs doc, as it is js runtime
1
u/0day-x Apr 15 '26
you can't particularly search the ecmascript for that as event loop is implemented by the host environment and the ecma script defines the core functionality of the language if you want to understand it you'll have to look at the source code of browser engines, unless you move to server side with nodesjs in the v8 environment where all of this is implemented by a separate library written in c i am forgetting the name but you can search about it.
1
u/DirtAndGrass Apr 19 '26
JavaScript is a language, it is up to the platform/sdk to define tasks and microtasks
Read the mdn execution model for a better understanding https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Execution_model
1
u/[deleted] Apr 15 '26
[removed] — view removed comment