WebAssembly bindings for Firnas.
Browsers are different systems, so they should be treated differently. For example, browsers doesn't have standard IO, so firnas abstracts the stdio
then firnas_wasm
provides a custom implementation and expose callbacks.
npm i firnas_wasm
# or
yarn install firnas_wasm
import init, { compile } from 'firnas_wasm';
init()
.then(() => {
let results = [];
let isLoading = false;
compile(
/* code */ code,
/* on print */ (res) => { results.push(res) },
/* on start compilation */ () => { isLoading = true; },
/* on finish execution */ () => {
console.log(results.join("\n"));
isLoading = false;
}
);
});