forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
24
Kha/Kinc/Backends/System/Wasm/JS-Sources/thread_starter.js
Normal file
24
Kha/Kinc/Backends/System/Wasm/JS-Sources/thread_starter.js
Normal file
@ -0,0 +1,24 @@
|
||||
function create_thread(func) {
|
||||
|
||||
}
|
||||
|
||||
onmessage = function(e) {
|
||||
console.log('onmessage');
|
||||
|
||||
const mod = e.data.mod;
|
||||
const memory = e.data.memory;
|
||||
const func = e.data.func;
|
||||
|
||||
const importObject = {
|
||||
env: { memory },
|
||||
imports: {
|
||||
imported_func: arg => console.log('thread: ' + arg),
|
||||
create_thread
|
||||
}
|
||||
};
|
||||
|
||||
WebAssembly.instantiate(mod, importObject).then((instance) => {
|
||||
console.log('Running thread');
|
||||
instance.exports[func]();
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user