wasm-import
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

WASM Import

ci status snyk npm version npm downloads/month npm downloads

npm i wasm-import

See MDN docs how to pass callbacks to wasm via importObject: https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Instance

load(
  fileName: string, // File name or URL
  importObject?: object // See MDN docs
): Promise<object>;

Example

import { load } from 'wasm-import';
// Alternative: const { load } = require('wasm-import');

const example = await load('example.wasm');

example.instance.exports.add(3, 7, (result) => {
  console.log({ result, expected: 10 });
});

License & Contributors

Copyright (c) 2023 WASM Import contributors. WASM Import is MIT licensed.

Package Sidebar

Install

npm i wasm-import

Homepage

metarhia.com

Weekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

7.38 kB

Total Files

8

Last publish

Collaborators

  • timur.shemsedinov