An AssemblyScript template with support for many environments
MIT License
An AssemblyScript template with support for many environments
This template is all you need to get started in AssemblyScript. It allows you to write a library in AssemblyScript, and use it in various environments.
./src/wasm/
../src/browser/
. It sets up a simple form to get input from the user and passes it to the wasm../src/node
.lib.ts
file is a library file, and the cli.ts
file is meant to be used as a Node bin../src/wasi
folder.Note: The AssemblyScript files have a .as.ts
or .as
extension, and the TypeScript files have a .ts
extension.
npm install
npm run build.wasm
./dist/index.wasm
export function doSomething(input: string): string
Build:
npm install
npm run build.browser
Run:
npm run start.browser
Build:
npm install
npm run build.browser
import { doSomething } from "./dist/browser/lib.js"
await doSomething("input")
Build:
npm install
npm run build.node
Run:
node ./dist/node/cli.js 'input'
import { doSomething } from "./dist/node/lib.js"
const output = await doSomething("input")
Build:
npm install
npm run build.wasi
Run:
wasmtime ./dist/wasi.wasm 'input'