compile
Compile with plugins, future default export
Parameters
Name | Type |
---|---|
source | string |
config | ConfigType |
Example
import { compile } from 'walt-compiler'; const buffer = compile(` let counter: i32 = 0; export function count(): i32 { counter += 1; return counter; } `).buffer(); WebAssembly.instantiate(buffer).then(result => { console.log(`First invocation: ${result.instance.exports.count()}`); console.log(`Second invocation: ${result.instance.exports.count()}`); });