mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
add a script for spider monkey
This commit is contained in:
parent
7383bd8f1f
commit
7a49b9fda9
21
test/de/inetsoftware/jwebassembly/SpiderMonkeyTest.js
Normal file
21
test/de/inetsoftware/jwebassembly/SpiderMonkeyTest.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var filename = '{test.wasm}';
|
||||||
|
var ret = read(filename, "binary");
|
||||||
|
|
||||||
|
function instantiate(bytes, imports) {
|
||||||
|
return WebAssembly.compile(bytes).then(
|
||||||
|
m => new WebAssembly.Instance(m, imports), reason => console.log(reason) );
|
||||||
|
}
|
||||||
|
|
||||||
|
var dependencies = {
|
||||||
|
"global": {},
|
||||||
|
"env": {}
|
||||||
|
};
|
||||||
|
dependencies["global.Math"] = Math;
|
||||||
|
|
||||||
|
|
||||||
|
instantiate( ret, dependencies ).then(
|
||||||
|
instance => console.log( instance.exports[scriptArgs[0]]( scriptArgs.slice(1) ) ),
|
||||||
|
reason => console.log(reason)
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user