Skip to content

Commit 9892937

Browse files
committed
Update readme
1 parent bc843d5 commit 9892937

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

plugins/web-worker-offloading/readme.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,15 @@ Offload JavaScript execution to a Web Worker.
1313

1414
This plugin offloads JavaScript execution to a Web Worker, improving performance by freeing up the main thread.
1515

16-
In order to opt-in a script to be loaded in a worker, simply add the `web-worker-offloading` script as a dependency.
16+
In order to opt-in a script to be loaded in a worker, simply add `worker` script data to a registered script. For example,
17+
if you have a script registered with the handle of `foo`, opt-in to offload it to a web worker by doing:
18+
19+
`
20+
wp_script_add_data( 'foo', 'worker', true );
21+
`
22+
23+
== Frequently Asked Questions ==
24+
25+
= Why are my offloaded scripts not working and I see a 404 error in the console for `partytown-sandbox-sw.html`? =
26+
27+
If you find that your offloaded scripts aren't working while also seeing a 404 error in the console for a file at `/wp-content/plugins/web-worker-offloading/build/partytown-sandbox-sw.html?1727389399791` then it's likely you have Chrome DevTools open with the "Bypass for Network" toggle enabled in the Application panel.

0 commit comments

Comments
 (0)