@polywrap/asyncify-js
TypeScript icon, indicating that this package has built-in type declarations

0.12.2 • Public • Published

@polywrap/asyncify-js

A 0 dependency wrapper around the Node.JS & Browser WebAssembly instance, which adds support for asyncify, enabling the use of async host import functions.

Usage

import { AsyncWasmInstance } from "@polywrap/asyncify-js";

// module.wasm must be asyncify enabled
const module: ArrayBuffer = getModule("./module.wasm");
const memory = new WebAssembly.Memory({ initial: 1 });

const instance = await AsyncWasmInstance.createInstance({
  module,
  imports: {
    my: {
      custom_import: async (arg: number): Promise<number> => {
        return await someAsyncCall(arg);
      }
    },
    env: {
      memory
    }
  }
});

await instance.exports.main();

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.12.27latest
0.12.0-pre.10pre

Version History

VersionDownloads (Last 7 Days)Published
0.12.27
0.12.10
0.12.00
0.12.0-pre.10
0.11.00
0.10.10
0.10.00
0.10.0-pre.140
0.9.70
0.10.0-pre.130
0.10.0-pre.120
0.10.0-pre.110
0.10.0-pre.100
0.9.62
0.10.0-pre.80
0.9.50
0.10.0-pre.70
0.10.0-pre.60
0.10.0-pre.50
0.10.0-pre.40
0.10.0-pre.30
0.10.0-pre.10
0.10.0-pre.00
0.9.40
0.9.30
0.9.20
0.9.10
0.9.00
0.8.00
0.7.00
0.6.01
0.5.00
0.4.10
0.4.00
0.3.00
0.2.00
0.1.10
0.1.00
0.0.1-prealpha.930
0.0.1-prealpha.920
0.0.1-prealpha.910
0.0.1-prealpha.900
0.0.1-prealpha.890
0.0.1-prealpha.880
0.0.1-prealpha.870
0.0.1-prealpha.860

Package Sidebar

Install

npm i @polywrap/asyncify-js

Weekly Downloads

10

Version

0.12.2

License

MIT

Unpacked Size

42 kB

Total Files

22

Last publish

Collaborators

  • polywrap-build-bot
  • dorgjelli