wat-tag
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

WAT Tag

A tag function for compiling inline WebAssembly written in the WAT text format.

Installation

npm install wat-tag

Usage

import {wat} from "wat-tag";
 
const module = await wat`
        (module
            (func (export "square") (param $i i32) (result i32)
                get_local $i
                get_local $i
                i32.mul
            )
        )
    `;
const instance = await WebAssembly.instantiate(module);
const result = instance.exports.square(3);

This package is useful for experimenting and learning WebAssembly, but I do not recommend it for production use.

-Rene

Dependencies (1)

Dev Dependencies (7)

Package Sidebar

Install

npm i wat-tag

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

6.61 kB

Total Files

5

Last publish

Collaborators

  • rhmoller