You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+109Lines changed: 109 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,115 @@ To remove the extension, execute:
29
29
pip uninstall jupyterlite-javascript-kernel
30
30
```
31
31
32
+
## Runtime modes
33
+
34
+
The extension currently registers two JavaScript kernelspecs:
35
+
36
+
-`JavaScript (IFrame)`:
37
+
Runs code in a hidden runtime `iframe` on the main page thread. Use this when your code needs browser DOM APIs like `document`, `window`, or canvas access through the page context.
38
+
-`JavaScript (Web Worker)`:
39
+
Runs code in a dedicated Web Worker. Use this for stronger isolation and to avoid blocking the main UI thread.
40
+
41
+
Pick either kernel from the notebook kernel selector in JupyterLite.
42
+
43
+
### Worker mode limitations
44
+
45
+
Web Workers do not expose DOM APIs. In `JavaScript (Web Worker)`, APIs such as `document`, direct element access, and other main-thread-only browser APIs are unavailable.
46
+
47
+
### Import side effects in iframe mode
48
+
49
+
In `JavaScript (IFrame)`, user code and imports execute in the runtime iframe scope.
50
+
51
+
By default, module-level side effects stay in the runtime iframe. To intentionally affect the main page (`window.parent`), access it directly.
52
+
53
+
Cell declarations like `var`, `let`, `const`, `function`, and `class` remain in the runtime scope. Host-page mutations happen when your code (or imported code) explicitly reaches `window.parent`.
0 commit comments