Skip to content

Commit 49d69ab

Browse files
committed
expand on the DOM api we support in workers
1 parent 23ccf47 commit 49d69ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/user-guide/plugins.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ page and a bad user experience.
8181
tasks without interfering with the user interface or other operations being perfomed in the main thread. While
8282
this adds great flexibility it's important to understand that workers actually have limited capabilities when
8383
comparing to code executed on the main thread. For instace, while PyScript offers a DOM API that actually can
84-
be used in web workers the browser, by default, does not allow DOM operation in workers.
84+
be used in web workers on the browser, by default, does not allow DOM operation in workers. So, in this case,
85+
if you just use `window` and `document` directly mapping the Javascript FFI provided directly by the interpreters
86+
we support (Pyodide and MicroPython): `from pyscript import window, document` will work and allow you to interact
87+
with the DOM while `from js import window, document` will not.
8588

8689
In general, we recommend executing your code on workers unless there are explicit reasons preventing users from
8790
doing that.

0 commit comments

Comments
 (0)