@@ -9,14 +9,12 @@ class ThreadRegistry {
9
9
workers = new Map ( ) ;
10
10
nextTid = 1 ;
11
11
12
- constructor ( { configuration } ) {
13
- this . configuration = configuration ;
14
- }
12
+ constructor ( ) { }
15
13
16
14
spawnThread ( worker , module , memory , startArg ) {
17
15
const tid = this . nextTid ++ ;
18
16
this . workers . set ( tid , worker ) ;
19
- worker . postMessage ( { module, memory, tid, startArg, configuration : this . configuration } ) ;
17
+ worker . postMessage ( { module, memory, tid, startArg } ) ;
20
18
return tid ;
21
19
}
22
20
@@ -39,8 +37,8 @@ class ThreadRegistry {
39
37
}
40
38
}
41
39
42
- async function start ( configuration = "release" ) {
43
- const response = await fetch ( `./.build/${ configuration } /MyApp .wasm` ) ;
40
+ async function start ( ) {
41
+ const response = await fetch ( `./.build/plugins/PackageToJS/outputs/Package/main .wasm` ) ;
44
42
const module = await WebAssembly . compileStreaming ( response ) ;
45
43
const memoryImport = WebAssembly . Module . imports ( module ) . find ( i => i . module === "env" && i . name === "memory" ) ;
46
44
if ( ! memoryImport ) {
@@ -51,7 +49,7 @@ async function start(configuration = "release") {
51
49
}
52
50
const memoryType = memoryImport . type ;
53
51
const memory = new WebAssembly . Memory ( { initial : memoryType . minimum , maximum : memoryType . maximum , shared : true } ) ;
54
- const threads = new ThreadRegistry ( { configuration } ) ;
52
+ const threads = new ThreadRegistry ( ) ;
55
53
const { instance, swiftRuntime, wasi } = await instantiate ( {
56
54
module,
57
55
threadChannel : threads ,
@@ -63,8 +61,7 @@ async function start(configuration = "release") {
63
61
return threads . spawnThread ( worker , module , memory , startArg ) ;
64
62
}
65
63
} ;
66
- } ,
67
- configuration
64
+ }
68
65
} ) ;
69
66
wasi . initialize ( instance ) ;
70
67
0 commit comments