@@ -4,10 +4,10 @@ import { hooks } from "../core.js";
4
4
// XXX TODO:
5
5
// 1. these imports should be lazy?
6
6
// 2. would be nice to automatically add xterm.css on demand
7
- import { Terminal } from ' https://cdn.jsdelivr.net/npm/xterm@5.3.0/+esm'
8
- import { Readline } from ' https://cdn.jsdelivr.net/npm/xterm-readline@1.1.1/+esm'
7
+ import { Terminal } from " https://cdn.jsdelivr.net/npm/xterm@5.3.0/+esm" ;
8
+ import { Readline } from " https://cdn.jsdelivr.net/npm/xterm-readline@1.1.1/+esm" ;
9
9
const makePyTerminal = ( ) => {
10
- const element = document . querySelector ( ' py-terminal' ) ;
10
+ const element = document . querySelector ( " py-terminal" ) ;
11
11
if ( element === null ) {
12
12
return false ;
13
13
}
@@ -19,7 +19,7 @@ const makePyTerminal = () => {
19
19
} ,
20
20
cursorBlink : true ,
21
21
cursorStyle : "block" ,
22
- rows : 50
22
+ rows : 50 ,
23
23
} ) ;
24
24
25
25
const rl = new Readline ( ) ;
@@ -40,7 +40,7 @@ const makePyTerminal = () => {
40
40
41
41
console . log ( "PyTerminal made?" ) ;
42
42
return { term, readline, write } ;
43
- }
43
+ } ;
44
44
45
45
// this is ONLY for non-workers, correct?
46
46
// TODO: how to make it working for workers?
@@ -64,6 +64,15 @@ hooks.onInterpreterReady.add(function override(pyScript) {
64
64
pyodide . setStderr ( { raw : myStdout } ) ;
65
65
} ) ;
66
66
67
+ hooks . onWorkerReady . add ( function override ( pyScript ) {
68
+ console . log ( "hello onWorkerReady" ) ;
69
+ const t = makePyTerminal ( ) ;
70
+ if ( ! t ) {
71
+ console . log ( "<py-terminal> not found, nothing to do" ) ;
72
+ return ;
73
+ }
74
+ console . log ( pyScript ) ;
75
+ } ) ;
67
76
68
77
// this is mostly pseudo-code for what it *should* happen for the workers case
69
78
/*
0 commit comments