1.1.1 • Published 1 year ago

wat-compiler v1.1.1

Weekly downloads
-
License
Public Domain
Repository
github
Last release
1 year ago

Install

$ npm i wat-compiler

API

Table of Contents

make

index.js:25-27

Compiles a WAT source string to a buffer.

import compile from 'wat-compiler'
const buffer = compile('(func (export "answer") (result i32) (i32.const 42))')
const mod = new WebAssembly.Module(buffer)
const instance = new WebAssembly.Instance(mod)
console.log(instance.exports.answer()) // => 42

Parameters

  • code string The WAT code to compile
  • options Options An options object

    • options.metrics boolean Enable metrics with console.time
  • context (optional, default {})

Returns Uint8Array The buffer to be passed on to WebAssembly

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

Public Domain © 2021 stagas

1.1.1

1 year ago

1.1.0

2 years ago

1.0.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago