@@ -162,7 +162,7 @@ WorkletGlobalScope</a> algorithm.
162162
163163The <a>event loop</a> is run on the <a>worklet global scope execution environment</a> defined above.
164164
165- It is expected that only tasks associated {{Worklet/import ()}} , the user agent invoking author
165+ It is expected that only tasks associated {{Worklet/addModule ()}} , the user agent invoking author
166166defined callbacks, and <a>microtasks</a> will use this <a>event loop</a> .
167167
168168Note:
@@ -293,13 +293,13 @@ Issue: Merge this with https://html.spec.whatwg.org/multipage/workers.html#set-u
293293Worklet {#worklet-section}
294294--------------------------
295295
296- The {{Worklet}} object provides the capability to import module scripts into its associated
296+ The {{Worklet}} object provides the capability to add module scripts into its associated
297297{{WorkletGlobalScope}} s. The user agent can then create classes registered on the
298298{{WorkletGlobalScope}} s and invoke their methods.
299299
300300<pre class='idl'>
301301interface Worklet {
302- [NewObject] Promise<void> import (USVString moduleURL, optional WorkletOptions options);
302+ [NewObject] Promise<void> addModule (USVString moduleURL, optional WorkletOptions options);
303303};
304304
305305dictionary WorkletOptions {
@@ -325,7 +325,7 @@ additional {{WorkletGlobalScope}}s should be transparent to the author.
325325
326326<div class='note'>
327327 Practically user agents aren't expected to implement the following algorithm using a
328- thread-safe map. Instead when {{Worklet/import ()}} is called user agents can fetch the module
328+ thread-safe map. Instead when {{Worklet/addModule ()}} is called user agents can fetch the module
329329 graph on the main thread, and send the fetched sources (the data contained in the <a>module
330330 responses map</a> ) to each thread which has a {{WorkletGlobalScope}} .
331331
@@ -338,7 +338,7 @@ A <dfn>pending tasks struct</dfn> is a <a>struct</a> consiting of:
338338This is used by the algorithms below.
339339
340340<div algorithm>
341- When the <dfn method for=Worklet>import (|moduleURL|, |options|)</dfn> method is called on a
341+ When the <dfn method for=Worklet>addModule (|moduleURL|, |options|)</dfn> method is called on a
342342{{Worklet}} object, the user agent <em> must</em> run the following steps:
343343 1. Let |promise| be <a>a new promise</a> .
344344
@@ -464,7 +464,7 @@ Note: Specifically, if a script fails to parse or fails to load over the network
464464 classes may have been registered correctly.
465465
466466<div class=example>
467- When an author imports code into a {{Worklet}} the code may run against multiple
467+ When an author adds code into a {{Worklet}} the code may run against multiple
468468 {{WorkletGlobalScope}} s, for example:
469469 <pre class='lang-javascript'>
470470 // script.js
@@ -473,7 +473,7 @@ Note: Specifically, if a script fails to parse or fails to load over the network
473473
474474 <pre class='lang-javascript'>
475475 // main.js
476- await CSS.paintWorklet.import ('script.js' );
476+ await CSS.paintWorklet.addModule ('script.js' );
477477 </pre>
478478
479479 Behind the scenes the user agent may load the <code class='lang-javascript'> script.js</code>
@@ -546,8 +546,8 @@ Loading scripts into a worklet. {#example-single}
546546-------------------------------------------------
547547
548548<pre class='lang-javascript'>
549- window.fakeWorklet1.import ('script1.js' );
550- window.fakeWorklet1.import ('script2.js' );
549+ window.fakeWorklet1.addModule ('script1.js' );
550+ window.fakeWorklet1.addModule ('script2.js' );
551551
552552// Assuming no other calls to fakeWorklet1 valid script loading orderings are:
553553// 1. 'script1.js' , 'script2.js'
@@ -559,8 +559,8 @@ Loading scripts into multiple worklets. {#example-multiple}
559559
560560<pre class='lang-javascript'>
561561Promise.all([
562- window.fakeWorklet1.import ('script1.js' ),
563- window.fakeWorklet2.import ('script2.js' )
562+ window.fakeWorklet1.addModule ('script1.js' ),
563+ window.fakeWorklet2.addModule ('script2.js' )
564564]).then(function() {
565565 // Both scripts now have loaded code, can do a task which relies on this.
566566});
0 commit comments