@@ -9,6 +9,7 @@ let raw_xserver: any;
9
9
10
10
async function waitRunDependency ( ) {
11
11
const promise = new Promise ( ( r : any ) => {
12
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
13
// @ts -ignore
13
14
globalThis . Module . monitorRunDependencies = ( n : number ) => {
14
15
if ( n === 0 ) {
@@ -20,8 +21,10 @@ async function waitRunDependency() {
20
21
// If there are no pending dependencies left, monitorRunDependencies will
21
22
// never be called. Since we can't check the number of dependencies,
22
23
// manually trigger a call.
24
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
25
// @ts -ignore
24
26
globalThis . Module . addRunDependency ( 'dummy' ) ;
27
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
25
28
// @ts -ignore
26
29
globalThis . Module . removeRunDependency ( 'dummy' ) ;
27
30
return promise ;
@@ -42,30 +45,25 @@ ctx.get_stdin = get_stdin;
42
45
// @ts -ignore: breaks typedoc
43
46
let resolveInputReply : any ;
44
47
45
- async function loadCppModule ( moduleFactory : any ) : Promise < any > {
48
+ async function load ( ) {
46
49
const options : any = { } ;
47
- // @ts -ignore
48
- globalThis . Module = await moduleFactory ( options ) ;
50
+
51
+ importScripts ( './xpython_wasm.js' ) ;
49
52
50
53
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
51
54
// @ts -ignore
52
- importScripts ( require ( './python_data' ) ) ;
55
+ globalThis . Module = await createXeusModule ( options ) ;
56
+
57
+ importScripts ( './python_data.js' ) ;
53
58
54
59
await waitRunDependency ( ) ;
60
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
55
61
// @ts -ignore
56
62
raw_xkernel = new globalThis . Module . xkernel ( ) ;
57
63
raw_xserver = raw_xkernel . get_server ( ) ;
58
64
raw_xkernel ! . start ( ) ;
59
65
}
60
66
61
- async function load ( ) {
62
- // @ts -ignore
63
- let xpython = importScripts ( require ( './xpython_wasm.js' ) ) ;
64
-
65
- // @ts -ignore
66
- return loadCppModule ( createXeusModule ) ;
67
- }
68
-
69
67
const loadCppModulePromise = load ( ) ;
70
68
71
69
ctx . onmessage = async ( event : MessageEvent ) : Promise < void > => {
0 commit comments