Skip to content

Commit

Permalink
Fix worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Namaneo committed Aug 7, 2023
1 parent f067a10 commit bc14f35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ui/sources/services/interop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Files from './files';
import Parallel from './parallel';

export class CoreInterface {
/** @param {WebAssembly.Memory} memory @param {MessagePort} port @param {number} start_arg @returns {Promise<void>} */
init(memory, port, start_arg) { }
/** @param {WebAssembly.Memory} memory @param {MessagePort} port @param {number} start_arg @param {string} script @returns {Promise<void>} */
init(memory, port, script, start_arg) { }

/** @param {string} system @param {string} rom @returns {Promise<void>} */
Create(system, rom) { }
Expand Down Expand Up @@ -83,7 +83,7 @@ export default class Interop {

const script = await (await fetch('worker.js')).text();
const core = await this.#parallel.create(name, script);
await core.init(memory, await Files.clone());
await core.init(memory, await Files.clone(), script);

return core;
}
Expand Down
6 changes: 3 additions & 3 deletions ui/sources/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ class Core {
/**
* @param {WebAssembly.Memory} memory
* @param {MessagePort} port
* @param {string} script
* @param {number} start_arg
* @returns {Promise<void>}
*/
async init(memory, port, start_arg) {
async init(memory, port, script, start_arg) {
const fs = new Parallel(Filesystem, true);
this.#wasi = new WASI(memory, fs.link(port));

Expand All @@ -119,9 +120,8 @@ class Core {
this.#threads.push(parallel);

const start = async () => {
const script = await (await fetch(`${origin}/worker.js`)).text();
const core = await parallel.create(name, script);
await core.init(memory, await parallel.open(), start_arg);
await core.init(memory, await parallel.open(), script, start_arg);
}

start();
Expand Down

0 comments on commit bc14f35

Please sign in to comment.