File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -365,6 +365,33 @@ the user agent <em>must</em> run the following steps:
365
365
366
366
7. Return |promise|.
367
367
368
+ <div class=example>
369
+ When an author imports code into a {{Worklet}} the code may run against multiple
370
+ {{WorkletGlobalScope}} s, for example:
371
+ <pre class='lang-javascript'>
372
+ // script.js
373
+ console.log('Hello from a WorkletGlobalScope!' );
374
+ </pre>
375
+
376
+ <pre class='lang-javascript'>
377
+ // main.js
378
+ await CSS.paintWorklet.import('script.js' );
379
+ </pre>
380
+
381
+ Behind the scenes the user-agent may load the <code class='lang-javascript'> script.js</code>
382
+ into 4 global scopes, in which case the debugging tools for the user-agent would print:
383
+ <pre class='lang-javascript'>
384
+ [paintWorklet#1] Hello from a WorkletGlobalScope!
385
+ [paintWorklet#4] Hello from a WorkletGlobalScope!
386
+ [paintWorklet#2] Hello from a WorkletGlobalScope!
387
+ [paintWorklet#3] Hello from a WorkletGlobalScope!
388
+ </pre>
389
+
390
+ If the user-agent decided to kill and restart a {{WorkletGlobalScope}} number 3 in this example,
391
+ it would print <code class='lang-javascript'> [paintWorklet#3] Hello from a
392
+ WorkletGlobalScope!</code> again in the debugging tools when this occurs.
393
+ </div>
394
+
368
395
Issue(w3c/css-houdini-drafts#47): Need ability to load code into a {{WorkletGlobalScope}}
369
396
declaratively.
370
397
You can’t perform that action at this time.
0 commit comments