Files: 891456b4ce75b2fdc83622388dc0ebf2837835cc / tests / typeChecking.js
1032 bytesRaw
1 | const customTypes = require('../customTypes.js') |
2 | const WasmContainer = require('../wasmContainer.js') |
3 | const fs = require('fs') |
4 | |
5 | async function main () { |
6 | let callerJSON = JSON.parse(fs.readFileSync('./wast/caller.json')) |
7 | let callerWasm = fs.readFileSync('./wasm/caller.wasm') |
8 | callerWasm = customTypes.inject(callerWasm, callerJSON) |
9 | |
10 | let recieverJSON = JSON.parse(fs.readFileSync('./wast/reciever.json')) |
11 | let recieverWasm = fs.readFileSync('./wasm/reciever.wasm') |
12 | recieverWasm = customTypes.inject(recieverWasm, recieverJSON) |
13 | |
14 | const callerContainer = new WasmContainer() |
15 | callerContainer.onCreation(callerWasm) |
16 | callerJSON = callerContainer.json |
17 | |
18 | const recieverContainer = new WasmContainer() |
19 | recieverContainer.onCreation(recieverWasm) |
20 | recieverJSON = recieverContainer.json |
21 | |
22 | const callFuncRef = callerContainer.getFuncRef('call') |
23 | |
24 | const funcRef = recieverContainer.getFuncRef('receive') |
25 | callFuncRef.args.push({ |
26 | type: 'funcRef', |
27 | arg: funcRef |
28 | }) |
29 | |
30 | callerContainer.onMessage(callFuncRef) |
31 | } |
32 | |
33 | main() |
34 |
Built with git-ssb-web