@@ -162,7 +162,7 @@ WorkletGlobalScope</a> algorithm.
162
162
163
163
The <a>event loop</a> is run on the <a>worklet global scope execution environment</a> defined above.
164
164
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
166
166
defined callbacks, and <a>microtasks</a> will use this <a>event loop</a> .
167
167
168
168
Note:
@@ -293,13 +293,13 @@ Issue: Merge this with https://html.spec.whatwg.org/multipage/workers.html#set-u
293
293
Worklet {#worklet-section}
294
294
--------------------------
295
295
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
297
297
{{WorkletGlobalScope}} s. The user agent can then create classes registered on the
298
298
{{WorkletGlobalScope}} s and invoke their methods.
299
299
300
300
<pre class='idl'>
301
301
interface Worklet {
302
- [NewObject] Promise<void> import (USVString moduleURL, optional WorkletOptions options);
302
+ [NewObject] Promise<void> addModule (USVString moduleURL, optional WorkletOptions options);
303
303
};
304
304
305
305
dictionary WorkletOptions {
@@ -325,7 +325,7 @@ additional {{WorkletGlobalScope}}s should be transparent to the author.
325
325
326
326
<div class='note'>
327
327
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
329
329
graph on the main thread, and send the fetched sources (the data contained in the <a>module
330
330
responses map</a> ) to each thread which has a {{WorkletGlobalScope}} .
331
331
@@ -338,7 +338,7 @@ A <dfn>pending tasks struct</dfn> is a <a>struct</a> consiting of:
338
338
This is used by the algorithms below.
339
339
340
340
<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
342
342
{{Worklet}} object, the user agent <em> must</em> run the following steps:
343
343
1. Let |promise| be <a>a new promise</a> .
344
344
@@ -464,7 +464,7 @@ Note: Specifically, if a script fails to parse or fails to load over the network
464
464
classes may have been registered correctly.
465
465
466
466
<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
468
468
{{WorkletGlobalScope}} s, for example:
469
469
<pre class='lang-javascript'>
470
470
// script.js
@@ -473,7 +473,7 @@ Note: Specifically, if a script fails to parse or fails to load over the network
473
473
474
474
<pre class='lang-javascript'>
475
475
// main.js
476
- await CSS.paintWorklet.import ('script.js' );
476
+ await CSS.paintWorklet.addModule ('script.js' );
477
477
</pre>
478
478
479
479
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}
546
546
-------------------------------------------------
547
547
548
548
<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' );
551
551
552
552
// Assuming no other calls to fakeWorklet1 valid script loading orderings are:
553
553
// 1. 'script1.js' , 'script2.js'
@@ -559,8 +559,8 @@ Loading scripts into multiple worklets. {#example-multiple}
559
559
560
560
<pre class='lang-javascript'>
561
561
Promise.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' )
564
564
]).then(function() {
565
565
// Both scripts now have loaded code, can do a task which relies on this.
566
566
});
0 commit comments