Skip to content

Commit bae35b1

Browse files
committed
Clarify that specification text usually starts on the event loop
Closes whatwg#2800.
1 parent 165101a commit bae35b1

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

source

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89150,13 +89150,22 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8915089150
<h5 id="event-loop-for-spec-authors">Dealing with the event loop from other specifications</h5>
8915189151

8915289152
<p>Writing specifications that correctly interact with the <span>event loop</span> can be tricky.
89153-
This is compounded by how this specification uses a concurrency-model-independent processing
89154-
model, so we say things like "<span>event loop</span>" and "<span>in parallel</span>" instead of
89155-
using more familiar model-specific terms like "main thread" or "on a background thread".</p>
89153+
This is compounded by how this specification uses concurrency-model-independent terminology, so we
89154+
say things like "<span>event loop</span>" and "<span>in parallel</span>" instead of using more
89155+
familiar model-specific terms like "main thread" or "on a background thread".</p>
8915689156

89157-
<p>The overriding guideline is that any work which would otherwise block the <span>event
89158-
loop</span> must instead be performed <span>in parallel</span> with it. This includes (but is not
89159-
limited to):</p>
89157+
<p>By default, specification text generally runs on the <span>event loop</span>. This falls out
89158+
from the formal <a href="#event-loop-processing-model">event loop processing model</a>, in that
89159+
you can eventually trace most algorithms back to a <span data-x="concept-task">task</span> <span
89160+
data-x="queue a task">queued</span> there.</p>
89161+
89162+
<p class="example">The algorithm steps for any JavaScript method will be invoked by author code
89163+
calling that method. And author code can only be run via queued tasks, usually originating
89164+
somewhere in the <a href="script-processing-model"><code>script</code> processing model</a>.</p>
89165+
89166+
<p>From this starting point, the overriding guideline is that any work a specification needs to
89167+
perform that would otherwise block the <span>event loop</span> must instead be performed <span>in
89168+
parallel</span> with it. This includes (but is not limited to):</p>
8916089169

8916189170
<ul>
8916289171
<li><p>performing heavy computation;</p></li>
@@ -89199,7 +89208,7 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8919989208

8920089209
<ol>
8920189210
<li><p>Do any synchronous setup work, while still on the <span>event loop</span>. This may
89202-
include converting <span data-x="JavaScript realm">realm-specific</span> JavaScript values into
89211+
include converting <span data-x="JavaScript realm">realm</span>-specific JavaScript values into
8920389212
realm-agnostic specification-level values.</p></li>
8920489213

8920589214
<li><p>Perform a set of potentially-expensive steps <span>in parallel</span>, operating entirely on

0 commit comments

Comments
 (0)